Skip to content

引导Guide

一、效果总览

二、描述

适用于页面功能引导。

三、构造函数及参数说明

OmniGuide

参数名参数类型描述是否必填默认值
contentCustomBuilder引导页组件的蒙版覆盖的内容
builderOmniGuideBuilder引导页的通用配置
onReady(controller: Controller) => void回调通知引导页组件即将显示,可获取Controller控制器

OmniGuideBuilder

参数名参数类型描述是否必填默认值
labelstring引导页名称
alwaysShowGuideboolean是否总是显示引导页false
guidePagesGuidePage[]引导页页面集合
visibleStateChangeListenerOnGuideChangedListener引导页面显示状态变化监听
pageChangedListenerOnPageChangedListener引导页面页数切换监听

GuidePage

参数名参数类型描述是否必填默认值
highLightsHighLight[]高亮组件/区域集合
highLightIndicatorCustomBuilder高亮指示层(页面级)null
bubbleIndicatorBubbleIndicator气泡指示器null
enterAnimationAnimatorOptions导页进入动画null
exitAnimationAnimatorOptions引导页退出动画null
backgroundColorstring引导页蒙版背景色#99000000
everywhereCancelableboolean是否点击任意位置切换到下一页true

BubbleIndicator

参数名参数类型描述是否必填默认值
componentIdstring被绑定的高亮组件ID
bubblePositionBubblePosition气泡指示器的展示方向BubblePosition.BOTTOM
bubbleBeanBubbleBean气泡指示器的内容

四、代码演示

typescript
aboutToAppear()
{
  this.builder = new OmniGuideBuilder()
    .setLabel('OmniGuideMultiPageExample')
    .alwaysShow(true)// 总是显示,调试时可以打开
    .setOnGuideChangedListener(this.visibleChangeListener)
    .setOnPageChangedListener(this.pageChangeListener)
    .addGuidePage(GuidePage.newInstance()
      .addHighLight('OmniTag')
      .setBubbleIndicator(
        new BubbleIndicator(
          'OmniTag',
          new BubbleBean('OmniTag内容标题', '这是一个标签示例,气泡说明在内容下方'),
          BubblePosition.BOTTOM
        )
      )
      .setEnterAnimation(this.enterAnimatorParam)
      .setExitAnimation(this.exitAnimatorParam)
    )
    .addGuidePage(GuidePage.newInstance()
      .addHighLight('Button1')
      .setBubbleIndicator(
        new BubbleIndicator(
          'Button1',
          new BubbleBean('左边的按钮标题', '这是一个左边的按钮示例,气泡说明在内容下方'),
          BubblePosition.BOTTOM
        )
      )
      .setEnterAnimation(this.enterAnimatorParam)
      .setExitAnimation(this.exitAnimatorParam)
    )
    .addGuidePage(GuidePage.newInstance()
      .addHighLight('Button2')
      .setBubbleIndicator(
        new BubbleIndicator(
          'Button2',
          new BubbleBean('右边的按钮标题', '这是一个右边的按钮示例,气泡说明在内容下方'),
          BubblePosition.BOTTOM
        )
      )
      .setEnterAnimation(this.enterAnimatorParam)
      .setExitAnimation(this.exitAnimatorParam)
    )
    .addGuidePage(GuidePage.newInstance()
      .addHighLight('TextLeft')
      .setBubbleIndicator(
        new BubbleIndicator(
          'TextLeft',
          new BubbleBean('左边的内容标题', '这是一个左边的内容示例,气泡说明在内容右方'),
          BubblePosition.RIGHT
        )
      )
      .setEnterAnimation(this.enterAnimatorParam)
      .setExitAnimation(this.exitAnimatorParam)
    )
    .addGuidePage(GuidePage.newInstance()
      .addHighLight('TextRight')
      .setBubbleIndicator(
        new BubbleIndicator(
          'TextRight',
          new BubbleBean('右边的内容标题', '这是一个左边的内容示例,气泡说明在内容左方'),
          BubblePosition.LEFT
        )
      )
      .setEnterAnimation(this.enterAnimatorParam)
      .setExitAnimation(this.exitAnimatorParam)
    )
    .addGuidePage(GuidePage.newInstance()
      .addHighLight('ButtonBottom')
      .setBubbleIndicator(
        new BubbleIndicator(
          'ButtonBottom',
          new BubbleBean('底部的内容标题', '这是一个底部的内容示例,气泡说明在内容上方'),
          BubblePosition.TOP
        )
      )
      .setEnterAnimation(this.enterAnimatorParam)
      .setExitAnimation(this.exitAnimatorParam)
    )
}

...

OmniGuide({
  content: this.content,
  builder: this.builder,
  onReady: (controllerParam: Controller) => {
    this.controller = controllerParam
    setTimeout(() => {
      this.controller?.show()
    }, 300)
  }
})