我们想要进行页面跳转就需要使用到navigator标签。
我们现在有两个页面index.vue和demo1.vue。
![](https://i-blog.csdnimg.cn/direct/37aa670c4e7d490aab2fa3fd4f81d474.png)
一、页面跳转(可返回)
index.vue中进行如下配置:
<template>
<view>这是主页面</view>
<navigator url="/pages/demo1/demo1">点我跳转到页面1</navigator>
</template>
demo1.vue中进行如下配置:
<template>
<view>这是页面1</view>
</template>
我们点击一下"跳转到页面1"就行进行跳转 。
![](https://i-blog.csdnimg.cn/direct/2caa132365b14c67bf7aba7f44254284.png)
跳转完成后,我们会注意到右上角有一个返回按钮,点击我们又能回到主页面。
![](https://i-blog.csdnimg.cn/direct/e47df9865ce946009110d2e89705f7dd.png)
二、页面跳转(不可返回)
我们有的时候需要点击后不可返回之前的页面。比如登录完成后不能再返回登录页。
我们添加如下属性:
open-type="reLaunch" 跳转并销毁之前的页面
![](https://i-blog.csdnimg.cn/direct/7eb56f9733e449e0bbff92a147790ae8.png)
跳转过后无返回按钮。
![](https://i-blog.csdnimg.cn/direct/7b436f8c6ea94969a662afea574936bd.png)