navigator
    同小程序用法类似,可用于跳转页面

    属性名 类型 默认值

    1. url String 应用内的跳转链接,值为相对路径或绝对路径,如:"../first/first""/pages/first/first",注意不能加 .vue 后缀
    2. open-type String navigate 跳转方式
    3. delta Number open-type 'navigateBack' 时有效,表示回退的层数
    4. hover-class String navigator-hover 指定点击时的样式类,当hover-class="none"时,没有点击态效果
    5. hover-stop-propagation Boolean false 指定是否阻止本节点的祖先节点出现点击态 微信小程序
    6. hover-start-time Number 50 按住后多久出现点击态,单位毫秒
    7. hover-stay-time Number 600 手指松开后点击态保留时间,单位毫秒
    8. open-type 有效值:

    值:

    1. navigate 对应 uni.navigateTo 的功能
    2. redirect 对应 uni.redirectTo 的功能
    3. switchTab 对应 uni.switchTab 的功能
    4. reLaunch 对应 uni.reLaunch 的功能 微信小程序
    5. navigateBack 对应 uni.navigateBack 的功能 微信小程序

    注意:navigator-hover 默认为 {background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;}, 的子节点背景色应为透明色。

    1. <template>
    2. <view>
    3. <view class="page-body">
    4. <view class="btn-area">
    5. <navigator url="navigate/navigate?title=navigate" hover-class="navigator-hover">
    6. <button type="default">跳转到新页面</button>
    7. </navigator>
    8. <navigator url="redirect/redirect?title=redirect" redirect hover-class="other-navigator-hover">
    9. <button type="default">在当前页打开</button>
    10. </navigator>
    11. </view>
    12. </view>
    13. </view>
    14. </template>
    15. export default {
    16. data() {
    17. return {
    18. title: 'navigator'
    19. }
    20. },
    21. methods: {
    22. }
    23. }

    页面的传值与接收

    1. <template>
    2. <view>
    3. <view class="page-body">
    4. <view class="btn-area">
    5. <navigator url="./test?title=navigate" hover-class="navigator-hover">
    6. <button type="default">跳转到新页面</button>
    7. </navigator>
    8. </view>
    9. </view>
    10. </view>
    11. </template>
    1. <script>
    2. export default {
    3. data:{},
    4. onLoad:function(options){
    5. console.log(options);
    6. console.log(options.title);
    7. }
    8. }
    9. </script>