forked from dcloudio/hello-uniapp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnavigator.vue
More file actions
58 lines (58 loc) · 1.38 KB
/
navigator.vue
File metadata and controls
58 lines (58 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="uni-btn-v">
<button @tap="navigateTo">跳转新页面,并传递数据</button>
<button @tap="navigateBack">返回上一页</button>
<button @tap="redirectTo">在当前页面打开</button>
<button @tap="switchTab">切换到模板选项卡</button>
<button @tap="reLaunch">关闭所有页面,打开首页</button>
<!-- #ifdef APP-PLUS -->
<button @tap="customAnimation">使用自定义动画打开页面</button>
<!-- #endif -->
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'navigate'
}
},
methods: {
navigateTo() {
uni.navigateTo({
url: 'new-page/new-vue-page-1?data=Hello'
})
},
navigateBack() {
uni.navigateBack();
},
redirectTo() {
uni.redirectTo({
url: 'new-page/new-vue-page-1'
});
},
switchTab() {
uni.switchTab({
url: '/pages/tabBar/template/template'
});
},
reLaunch() {
uni.reLaunch({
url: '/pages/tabBar/component/component'
});
},
customAnimation(){
uni.navigateTo({
url: 'new-page/new-vue-page-1?data=使用自定义动画打开页面',
animationType: 'slide-in-bottom',
animationDuration: 200
})
}
}
}
</script>