tencent cloud

文档反馈

导航组件

最后更新时间:2024-03-04 22:43:53
    功能说明:页面链接。
    参数及说明
    属性
    类型
    默认值
    必填
    说明
    target
    string
    self
    -
    在哪个目标上发生跳转,默认当前小程序,可选值 self/miniProgram
    url
    string
    -
    当前小程序内的跳转
    open-type
    string
    navigate
    跳转方式
    path
    string
    -
    -
    当 target="miniProgram"时有效,打开的页面路径,如果为空则打开首页
    extra-data
    object
    -
    -
    当 target="miniProgram"时有效,需要传递给目标小程序的数据,目标小程序可在App.onLaunch()App.onShow() 中获取到这份数据。
    hover-class
    string
    navigator-hover
    -
    指定点击时的样式类,当hover-class="none"时,没有点击态效果
    hover-stop-propagation
    boolean
    false
    -
    指定是否阻止本节点的祖先节点出现点击态
    hover-start-time
    number
    50
    -
    按住后多久出现点击态,单位毫秒
    hover-stay-time
    number
    600
    -
    手指松开后点击态保留时间,单位毫秒
    bindsuccess
    string
    -
    -
    当target="miniProgram"时有效,跳转小程序成功
    bindfail
    string
    -
    -
    当target="miniProgram"时有效,跳转小程序失败
    bindcomplete
    string
    -
    -
    当target="miniProgram"时有效,跳转小程序完成
    aria-label
    string
    -
    -
    无障碍访问,(属性)元素的额外描述
    open-type有效值:
    合法值
    说明
    navigate
    对应 wx.navigateTo 或 wx.navigateToMiniProgram 的功能
    redirect
    对应 wx.redirectTo 的功能
    switchTab
    对应 wx.switchTab 的功能
    reLaunch
    对应 wx.reLaunch 的功能
    navigateBack
    对应 wx.navigateBack 的功能
    使用限制:需要用户确认跳转
    在跳转至其他小程序前,将统一增加弹窗,询问是否跳转,用户确认后才可以跳转至其他小程序。如果用户单击取消,则回调fail cancel
    注意:
    navigator-hover默认为{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;},<navigator>的子节点背景色应为透明色。
    示例代码:
    /** wxss **/
    /** 修改默认的navigator点击态 **/
    .navigator-hover {
    color: blue;
    }
    /** 自定义其他点击态样式类 **/
    .other-navigator-hover {
    color: red;
    }
    <!-- sample.wxml -->
    <view class="btn-area">
    <navigator
    url="/page/navigate/navigate?title=navigate"
    hover-class="navigator-hover"
    >
    跳转到新页面
    </navigator>
    <navigator
    url="../../redirect/redirect/redirect?title=redirect"
    open-type="redirect"
    hover-class="other-navigator-hover"
    >
    在当前页打开
    </navigator>
    <navigator
    url="/page/index/index"
    open-type="switchTab"
    hover-class="other-navigator-hover"
    >
    切换 Tab
    </navigator>
    </view>
    <!-- navigator.wxml -->
    <view style="text-align:center">{{title}}</view>
    <view>点击左上角返回回到之前页面</view>
    // redirect.js navigator.js
    Page({
    onLoad(options) {
    this.setData({
    title: options.title
    })
    }
    })
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持