Commit a513d3e 1 parent c9e9398 commit a513d3e Copy full SHA for a513d3e
File tree 4 files changed +7
-8
lines changed
src/pages/demo/route-interceptor
4 files changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
<route lang="json5" type="page">
2
2
{
3
- needLogin: true,
4
3
style: { navigationBarTitleText: '登陆拦截' },
5
4
}
6
5
</route >
7
6
8
7
<template >
9
- <view class =" mt-8 text-center" >
8
+ <view class =" mt-8 text-center p-4 " >
10
9
<view class =" " >登陆拦截的时候的登录有如下3种情况</view >
11
10
<view class =" " >1.登录动作有单独的登录页面,需要通过重定向处理</view >
12
11
<view class =" " >
16
15
<view class =" leading-10" >
17
16
用户是否已登录:<text >{{ isLogined ? '是' : '否' }}</text >
18
17
</view >
19
- <button v-if =" !isLogined" @click =" setUserInfo" >登陆</button >
20
- <button v-else @click =" clearUserInfo" class =" mt-4" >登出</button >
18
+ <button v-if =" !isLogined" @click =" setUserInfo" class = " mt-4 " type = " primary " >登陆</button >
19
+ <button v-else @click =" clearUserInfo" class =" mt-4" type = " warn " >登出</button >
21
20
</view >
22
21
</template >
23
22
Original file line number Diff line number Diff line change 8
8
</route >
9
9
10
10
<template >
11
- <view class =" mt-8 text-center" >
11
+ <view class =" mt-8 text-center p-4 " >
12
12
<view class =" " >
13
13
自动登录,通常在小程序里面都会先自动登录,所以都是登录状态,无需拦截。这个项目不方便演示,后续开个新项目演示
14
14
</view >
Original file line number Diff line number Diff line change 5
5
</route >
6
6
7
7
<template >
8
- <view class =" mt-8 text-center" >
8
+ <view class =" mt-8 text-center p-4 " >
9
9
<view class =" leading-10" >
10
10
用户是否已登录:<text >{{ isLogined ? '是' : '否' }}</text >
11
11
</view >
12
12
<view >这里有一个按钮(比如点赞按钮),点击这个按钮需要先登录</view >
13
- <button @tap =" onClick" >点赞菲鸽</button >
13
+ <button type = " primary " @tap =" onClick" class = " mt-4 " >点赞菲鸽</button >
14
14
<uv-modal
15
15
ref =" modal"
16
16
title =" 登陆"
Original file line number Diff line number Diff line change 6
6
</route >
7
7
8
8
<template >
9
- <view class =" mt-8 text-center" >
9
+ <view class =" mt-8 text-center p-4 " >
10
10
<view class =" leading-10" >
11
11
用户是否已登录:<text >{{ isLogined ? '是' : '否' }}</text >
12
12
</view >
You can’t perform that action at this time.
0 commit comments