首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在牧羊人中添加自定义功能

如何在牧羊人中添加自定义功能
EN

Stack Overflow用户
提问于 2022-06-17 08:41:04
回答 1查看 254关注 0票数 0

如何在牧羊人的下一个按钮上添加自定义功能?我需要在牧羊人弹出框中添加GA事件,但无法找到如何在单击next按钮上添加事件,请有人帮助。

代码语言:javascript
复制
export const builtInButtons = {
  cancel: {
    classes: 'btn-purple-bg me-2 mt-2 sfpro-regular sepheredDone',
    secondary: true,
    text: '<span class="button-text">Done</span>',
    type: 'cancel',
  },
  next: {
    classes: 'btn-purple-bg me-2 mt-2 sfpro-regular',
    text: '<span class="button-text">Next</span>',
    type: 'next',
    
  },
  back: {
    classes: 'btn-purple-bg me-2 mt-2 sfpro-regular',
    secondary: true,
    text: '<span class="button-text">Previous</span>',
    type: 'back',
  },
  stepOne: {
    classes: 'sfpro-regular me-2 mt-2 sepheredStep',
    secondary: true,
    text: '<span type="text" class="sfpro-regular opacity-90 fs-14px ls-28 m-sm-2 ">1 of 6</span>',
  },
  stepTwo: {
    classes: 'sfpro-regular me-2 mt-2 sepheredStep',
    secondary: true,
    text: '<span type="text" class="sfpro-regular opacity-90 fs-14px ls-28 m-sm-2 ">2 of 6</span>',
    type: 'back',
  },
  stepThree: {
    classes: 'sfpro-regular me-2 mt-2 sepheredStep',
    secondary: true,
    text: '<span type="text" class="sfpro-regular opacity-90 fs-14px ls-28 m-sm-2 ">3 of 6</span>',
    type: 'back',
  },
  stepFour: {
    classes: 'sfpro-regular me-2 mt-2 sepheredStep',
    secondary: true,
    text: '<span type="text" class="sfpro-regular opacity-90 fs-14px ls-28 m-sm-2 ">4 of 6</span>',
    type: 'back',
  },
  stepFive: {
    classes: 'sfpro-regular me-2 mt-2 sepheredStep',
    secondary: true,
    text: '<span type="text" class="sfpro-regular opacity-90 fs-14px ls-28 m-sm-2 ">5 of 6</span>',
    type: 'back',
  },
  stepSix: {
    classes: 'sfpro-regular me-2 mt-2 sepheredStep',
    secondary: true,
    text: '<span type="text" class="sfpro-regular opacity-90 fs-14px ls-28 m-sm-2 ">6 of 6</span>',
    type: 'back',
  },
};

export const defaultStepOptions: Step.StepOptions = {
  classes: 'shepherd-theme-arrows custom-default-class',
  scrollTo: { behavior: 'smooth', block: 'center' },
  cancelIcon: {
    enabled: true,
  },
};
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-07-21 12:37:41

可以向每个按钮添加action(){ do_something }

代码语言:javascript
复制
 next: {
    classes: 'btn-purple-bg me-2 mt-2 sfpro-regular',
    text: '<span class="button-text">Next</span>',
    type: 'next',
    action() {
      return this.show('some_step_name');
    }    
  }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72656581

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档