@yyp92-cli/template-vue-mobile 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/template/src/components/layout/index.vue +16 -19
- package/template/src/components/layout/tabBar/index.vue +10 -7
- package/template/src/router/index.ts +0 -2
- package/template/src/router/routes.tsx +14 -3
- package/template/src/store/login/index.ts +10 -0
- package/template/src/views/home/index.vue +23 -0
- package/template/src/views/home/screen-detail/index.vue +19 -0
- package/template/src/views/login/index.vue +7 -2
- /package/template/src/views/{detail → home/detail}/index.vue +0 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,27 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="layout">
|
|
3
|
-
<
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
<MyNavBar
|
|
11
|
-
:title="title"
|
|
12
|
-
:showLeftArrow="route.fullPath !== '/home'"
|
|
13
|
-
/>
|
|
14
|
-
</div>
|
|
3
|
+
<div class="layout-inner">
|
|
4
|
+
<div class="header">
|
|
5
|
+
<MyNavBar
|
|
6
|
+
:title="title"
|
|
7
|
+
:showLeftArrow="route.fullPath !== '/home'"
|
|
8
|
+
/>
|
|
9
|
+
</div>
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
11
|
+
<div class="content">
|
|
12
|
+
<router-view></router-view>
|
|
13
|
+
</div>
|
|
19
14
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
<div
|
|
16
|
+
class="footer"
|
|
17
|
+
v-if="!route.meta.showFullScreen"
|
|
18
|
+
>
|
|
19
|
+
<MyTabBar />
|
|
23
20
|
</div>
|
|
24
|
-
</
|
|
21
|
+
</div>
|
|
25
22
|
</div>
|
|
26
23
|
</template>
|
|
27
24
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="tab-bar">
|
|
3
3
|
<van-tabbar
|
|
4
|
-
v-model="
|
|
4
|
+
v-model="defaultActive"
|
|
5
5
|
>
|
|
6
6
|
<template
|
|
7
7
|
v-for="item in loginStore.userMenus"
|
|
@@ -21,18 +21,21 @@
|
|
|
21
21
|
lang="ts"
|
|
22
22
|
name="MyTabBar"
|
|
23
23
|
>
|
|
24
|
-
import {
|
|
24
|
+
import {computed} from 'vue'
|
|
25
25
|
import {useRoute} from 'vue-router'
|
|
26
26
|
import useLoginStore from '@/store/login'
|
|
27
27
|
|
|
28
28
|
const route = useRoute()
|
|
29
29
|
const loginStore = useLoginStore()
|
|
30
|
-
const active = ref(0)
|
|
31
|
-
console.log('--loginStore.userMenus', loginStore.userMenus)
|
|
32
30
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
|
|
32
|
+
const defaultActive = computed(() => {
|
|
33
|
+
const list = route.path?.split('/')
|
|
34
|
+
const newPath = list.length > 3 ? list?.slice(0, 3)?.join('/') : route.path
|
|
35
|
+
|
|
36
|
+
const index = loginStore.userMenus.findIndex((item: any) => newPath.indexOf(item.path) > -1)
|
|
37
|
+
|
|
38
|
+
return index
|
|
36
39
|
})
|
|
37
40
|
</script>
|
|
38
41
|
|
|
@@ -50,13 +50,24 @@ export const routes: any[] = [
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
path: '/detail',
|
|
54
|
-
name: 'detail',
|
|
55
|
-
component: () => import('@/views/detail/index.vue'),
|
|
53
|
+
path: '/home/detail',
|
|
54
|
+
name: '/home/detail',
|
|
55
|
+
component: () => import('@/views/home/detail/index.vue'),
|
|
56
56
|
meta: {
|
|
57
57
|
title: '详情',
|
|
58
58
|
icon: '',
|
|
59
59
|
hideMenu: true,
|
|
60
|
+
showFullScreen: false
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
path: '/home/screen-detail',
|
|
65
|
+
name: '/home/screen-detail',
|
|
66
|
+
component: () => import('@/views/home/screen-detail/index.vue'),
|
|
67
|
+
meta: {
|
|
68
|
+
title: '详情-全屏',
|
|
69
|
+
icon: '',
|
|
70
|
+
hideMenu: true,
|
|
60
71
|
showFullScreen: true
|
|
61
72
|
}
|
|
62
73
|
},
|
|
@@ -24,6 +24,16 @@ const useLoginStore = defineStore(
|
|
|
24
24
|
async loginAccountAction(account: any) {
|
|
25
25
|
try {
|
|
26
26
|
setTimeout(() => {
|
|
27
|
+
const userInfo = {
|
|
28
|
+
username: account.username
|
|
29
|
+
}
|
|
30
|
+
const token = '111'
|
|
31
|
+
this.userInfo = userInfo
|
|
32
|
+
this.token = token
|
|
33
|
+
|
|
34
|
+
localCache.setCache(USER_INFO, userInfo)
|
|
35
|
+
localCache.setCache(LOGIN_TOKEN, token)
|
|
36
|
+
|
|
27
37
|
const menus = routes[0].children.filter((item: any) => !item.meta.hideMenu)
|
|
28
38
|
const promissions = routes[0].children.map((item: any) => item.path)
|
|
29
39
|
this.userMenus = menus
|
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="home">
|
|
3
3
|
<h2>home</h2>
|
|
4
|
+
|
|
5
|
+
<div>
|
|
6
|
+
<van-button
|
|
7
|
+
type="primary"
|
|
8
|
+
@click="handleJump"
|
|
9
|
+
>详情</van-button>
|
|
10
|
+
|
|
11
|
+
<van-button
|
|
12
|
+
type="primary"
|
|
13
|
+
@click="handleJump1"
|
|
14
|
+
>详情-全屏</van-button>
|
|
15
|
+
</div>
|
|
4
16
|
</div>
|
|
5
17
|
</template>
|
|
6
18
|
|
|
@@ -9,6 +21,17 @@
|
|
|
9
21
|
lang="ts"
|
|
10
22
|
name="Home"
|
|
11
23
|
>
|
|
24
|
+
import {useRouter} from 'vue-router'
|
|
25
|
+
|
|
26
|
+
const router = useRouter()
|
|
27
|
+
|
|
28
|
+
function handleJump() {
|
|
29
|
+
router.push('/home/detail')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function handleJump1() {
|
|
33
|
+
router.push('/home/screen-detail')
|
|
34
|
+
}
|
|
12
35
|
</script>
|
|
13
36
|
|
|
14
37
|
<style
|
|
@@ -21,8 +21,13 @@
|
|
|
21
21
|
</van-cell-group>
|
|
22
22
|
|
|
23
23
|
<div style="margin: 16px;">
|
|
24
|
-
<van-button
|
|
25
|
-
|
|
24
|
+
<van-button
|
|
25
|
+
round
|
|
26
|
+
block
|
|
27
|
+
type="primary"
|
|
28
|
+
native-type="submit"
|
|
29
|
+
>
|
|
30
|
+
提交
|
|
26
31
|
</van-button>
|
|
27
32
|
</div>
|
|
28
33
|
</van-form>
|
|
File without changes
|