create-weapp-vite 2.0.53 → 2.0.55
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/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{src-j_bda7hF.js → src-nL81L3Ai.js} +11 -9
- package/package.json +1 -1
- package/templates/default/package.json +3 -2
- package/templates/default/project.private.config.json +1 -1
- package/templates/default/src/app.json +2 -1
- package/templates/default/src/layouts/admin/index.json +3 -0
- package/templates/default/src/layouts/admin/index.scss +40 -0
- package/templates/default/src/layouts/admin/index.ts +1 -0
- package/templates/default/src/layouts/admin/index.wxml +10 -0
- package/templates/default/src/layouts/default/index.json +3 -0
- package/templates/default/src/layouts/default/index.scss +3 -0
- package/templates/default/src/layouts/default/index.ts +1 -0
- package/templates/default/src/layouts/default/index.wxml +3 -0
- package/templates/default/src/pages/index/index.ts +5 -0
- package/templates/default/src/pages/index/index.wxml +3 -0
- package/templates/default/src/pages/layouts/index.json +4 -0
- package/templates/default/src/pages/layouts/index.scss +68 -0
- package/templates/default/src/pages/layouts/index.ts +42 -0
- package/templates/default/src/pages/layouts/index.wxml +19 -0
- package/templates/default/tsconfig.json +8 -2
- package/templates/lib/package.json +6 -2
- package/templates/lib/project.private.config.json +1 -1
- package/templates/lib/src/app.json +2 -1
- package/templates/lib/src/layouts/admin/index.json +3 -0
- package/templates/lib/src/layouts/admin/index.scss +41 -0
- package/templates/lib/src/layouts/admin/index.ts +1 -0
- package/templates/lib/src/layouts/admin/index.wxml +10 -0
- package/templates/lib/src/layouts/default/index.json +3 -0
- package/templates/lib/src/layouts/default/index.scss +3 -0
- package/templates/lib/src/layouts/default/index.ts +1 -0
- package/templates/lib/src/layouts/default/index.wxml +3 -0
- package/templates/lib/src/pages/index/index.scss +14 -3
- package/templates/lib/src/pages/index/index.ts +5 -0
- package/templates/lib/src/pages/index/index.wxml +6 -0
- package/templates/lib/src/pages/layouts/index.json +4 -0
- package/templates/lib/src/pages/layouts/index.scss +70 -0
- package/templates/lib/src/pages/layouts/index.ts +44 -0
- package/templates/lib/src/pages/layouts/index.wxml +19 -0
- package/templates/lib/tsconfig.json +8 -2
- package/templates/lib/weapp-vite.lib.config.ts +5 -0
- package/templates/tailwindcss/package.json +3 -3
- package/templates/tailwindcss/project.private.config.json +1 -1
- package/templates/tailwindcss/src/app.json +2 -1
- package/templates/tailwindcss/src/layouts/admin/index.json +3 -0
- package/templates/tailwindcss/src/layouts/admin/index.scss +40 -0
- package/templates/tailwindcss/src/layouts/admin/index.ts +1 -0
- package/templates/tailwindcss/src/layouts/admin/index.wxml +10 -0
- package/templates/tailwindcss/src/layouts/default/index.json +3 -0
- package/templates/tailwindcss/src/layouts/default/index.scss +3 -0
- package/templates/tailwindcss/src/layouts/default/index.ts +1 -0
- package/templates/tailwindcss/src/layouts/default/index.wxml +3 -0
- package/templates/tailwindcss/src/pages/index/index.ts +5 -0
- package/templates/tailwindcss/src/pages/index/index.wxml +3 -0
- package/templates/tailwindcss/src/pages/layouts/index.json +4 -0
- package/templates/tailwindcss/src/pages/layouts/index.scss +1 -0
- package/templates/tailwindcss/src/pages/layouts/index.ts +33 -0
- package/templates/tailwindcss/src/pages/layouts/index.wxml +19 -0
- package/templates/tailwindcss/tsconfig.json +8 -2
- package/templates/tdesign/package.json +3 -3
- package/templates/tdesign/project.private.config.json +2 -2
- package/templates/tdesign/src/app.json +2 -1
- package/templates/tdesign/src/layouts/admin/index.json +3 -0
- package/templates/tdesign/src/layouts/admin/index.scss +40 -0
- package/templates/tdesign/src/layouts/admin/index.ts +1 -0
- package/templates/tdesign/src/layouts/admin/index.wxml +10 -0
- package/templates/tdesign/src/layouts/default/index.json +3 -0
- package/templates/tdesign/src/layouts/default/index.scss +3 -0
- package/templates/tdesign/src/layouts/default/index.ts +1 -0
- package/templates/tdesign/src/layouts/default/index.wxml +3 -0
- package/templates/tdesign/src/pages/index/index.ts +5 -0
- package/templates/tdesign/src/pages/index/index.wxml +3 -0
- package/templates/tdesign/src/pages/layouts/index.json +4 -0
- package/templates/tdesign/src/pages/layouts/index.scss +1 -0
- package/templates/tdesign/src/pages/layouts/index.ts +32 -0
- package/templates/tdesign/src/pages/layouts/index.wxml +16 -0
- package/templates/tdesign/tsconfig.json +8 -2
- package/templates/tdesign/vite.config.ts +9 -0
- package/templates/vant/package.json +3 -3
- package/templates/vant/project.private.config.json +1 -1
- package/templates/vant/src/app.json +2 -1
- package/templates/vant/src/layouts/admin/index.json +3 -0
- package/templates/vant/src/layouts/admin/index.scss +40 -0
- package/templates/vant/src/layouts/admin/index.ts +1 -0
- package/templates/vant/src/layouts/admin/index.wxml +10 -0
- package/templates/vant/src/layouts/default/index.json +3 -0
- package/templates/vant/src/layouts/default/index.scss +3 -0
- package/templates/vant/src/layouts/default/index.ts +1 -0
- package/templates/vant/src/layouts/default/index.wxml +3 -0
- package/templates/vant/src/pages/index/index.ts +5 -0
- package/templates/vant/src/pages/index/index.wxml +3 -0
- package/templates/vant/src/pages/layouts/index.json +4 -0
- package/templates/vant/src/pages/layouts/index.scss +3 -0
- package/templates/vant/src/pages/layouts/index.ts +35 -0
- package/templates/vant/src/pages/layouts/index.wxml +17 -0
- package/templates/vant/tsconfig.json +8 -2
- package/templates/vant/vite.config.ts +9 -0
- package/templates/wevu/package.json +4 -3
- package/templates/wevu/project.private.config.json +2 -2
- package/templates/wevu/src/layouts/admin.vue +75 -0
- package/templates/wevu/src/layouts/default.vue +17 -0
- package/templates/wevu/src/pages/index/index.vue +7 -0
- package/templates/wevu/src/pages/layouts/index.vue +171 -0
- package/templates/wevu/tsconfig.json +8 -2
- package/templates/wevu-tdesign/package.json +4 -4
- package/templates/wevu-tdesign/project.private.config.json +1 -1
- package/templates/wevu-tdesign/src/app.vue +1 -0
- package/templates/wevu-tdesign/src/components/KpiBoard/index.vue +4 -6
- package/templates/wevu-tdesign/src/hooks/useToast.ts +1 -1
- package/templates/wevu-tdesign/src/layouts/admin.vue +37 -0
- package/templates/wevu-tdesign/src/layouts/default.vue +17 -0
- package/templates/wevu-tdesign/src/pages/index/index.vue +10 -0
- package/templates/wevu-tdesign/src/pages/layouts/index.vue +96 -0
- package/templates/wevu-tdesign/src/subpackages/lab/index.vue +22 -6
- package/templates/wevu-tdesign/tsconfig.json +8 -2
- package/templates/wevu-tdesign/vite.config.ts +9 -0
- package/templates/default/tsconfig.app.json +0 -49
- package/templates/default/tsconfig.node.json +0 -33
- package/templates/lib/tsconfig.app.json +0 -49
- package/templates/lib/tsconfig.node.json +0 -33
- package/templates/tailwindcss/tsconfig.app.json +0 -49
- package/templates/tailwindcss/tsconfig.node.json +0 -33
- package/templates/tdesign/tsconfig.app.json +0 -52
- package/templates/tdesign/tsconfig.node.json +0 -33
- package/templates/vant/tsconfig.app.json +0 -52
- package/templates/vant/tsconfig.node.json +0 -33
- package/templates/wevu/src/components.d.ts +0 -25
- package/templates/wevu/src/typed-components.d.ts +0 -22
- package/templates/wevu/src/typed-router.d.ts +0 -67
- package/templates/wevu/tsconfig.app.json +0 -51
- package/templates/wevu/tsconfig.node.json +0 -33
- package/templates/wevu-tdesign/src/components.d.ts +0 -267
- package/templates/wevu-tdesign/src/typed-components.d.ts +0 -955
- package/templates/wevu-tdesign/src/typed-router.d.ts +0 -75
- package/templates/wevu-tdesign/tsconfig.app.json +0 -54
- package/templates/wevu-tdesign/tsconfig.node.json +0 -33
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
.layout-admin {
|
|
2
|
+
min-height: 100%;
|
|
3
|
+
background:
|
|
4
|
+
radial-gradient(circle at top right, rgb(239 68 68 / 18%), transparent 28%),
|
|
5
|
+
linear-gradient(180deg, #fff8f8 0%, #fff1f2 100%);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.layout-admin__hero {
|
|
9
|
+
padding: 36rpx 32rpx 32rpx;
|
|
10
|
+
color: #fff;
|
|
11
|
+
background: linear-gradient(145deg, #7f1d1d 0%, #dc2626 64%, #f87171 100%);
|
|
12
|
+
border-radius: 0 0 28rpx 28rpx;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.layout-admin__eyebrow {
|
|
16
|
+
display: inline-flex;
|
|
17
|
+
padding: 8rpx 16rpx;
|
|
18
|
+
font-size: 22rpx;
|
|
19
|
+
background: rgb(255 255 255 / 14%);
|
|
20
|
+
border-radius: 999rpx;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.layout-admin__title {
|
|
24
|
+
display: block;
|
|
25
|
+
margin-top: 18rpx;
|
|
26
|
+
font-size: 42rpx;
|
|
27
|
+
font-weight: 700;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.layout-admin__subtitle {
|
|
31
|
+
display: block;
|
|
32
|
+
margin-top: 12rpx;
|
|
33
|
+
font-size: 24rpx;
|
|
34
|
+
line-height: 1.7;
|
|
35
|
+
opacity: 0.92;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.layout-admin__body {
|
|
39
|
+
padding-bottom: 32rpx;
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Component({})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<view class="layout-admin">
|
|
2
|
+
<view class="layout-admin__hero">
|
|
3
|
+
<text class="layout-admin__eyebrow">layouts/admin/index.wxml</text>
|
|
4
|
+
<text class="layout-admin__title">{{title || 'Vant Admin Layout'}}</text>
|
|
5
|
+
<text class="layout-admin__subtitle">{{subtitle || 'Vant 原生模板也支持 setPageLayout()。'}}</text>
|
|
6
|
+
</view>
|
|
7
|
+
<view class="layout-admin__body">
|
|
8
|
+
<slot />
|
|
9
|
+
</view>
|
|
10
|
+
</view>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Component({})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import Dialog from '@vant/weapp/dialog/dialog'
|
|
2
|
+
import { setPageLayout } from 'weapp-vite/runtime'
|
|
3
|
+
|
|
4
|
+
Page({
|
|
5
|
+
data: {
|
|
6
|
+
currentLayout: 'default',
|
|
7
|
+
},
|
|
8
|
+
onLoad() {
|
|
9
|
+
setPageLayout('default')
|
|
10
|
+
},
|
|
11
|
+
applyDefaultLayout() {
|
|
12
|
+
this.setData({ currentLayout: 'default' })
|
|
13
|
+
setPageLayout('default')
|
|
14
|
+
},
|
|
15
|
+
applyAdminLayout() {
|
|
16
|
+
this.setData({ currentLayout: 'admin' })
|
|
17
|
+
setPageLayout('admin', {
|
|
18
|
+
title: 'Vant Console',
|
|
19
|
+
subtitle: '这个标题来自原生 Page 调用 setPageLayout()。',
|
|
20
|
+
})
|
|
21
|
+
},
|
|
22
|
+
clearLayout() {
|
|
23
|
+
this.setData({ currentLayout: 'none' })
|
|
24
|
+
setPageLayout(false)
|
|
25
|
+
},
|
|
26
|
+
showState() {
|
|
27
|
+
Dialog.alert({
|
|
28
|
+
title: '当前布局',
|
|
29
|
+
message: `当前状态:${this.data.currentLayout}`,
|
|
30
|
+
})
|
|
31
|
+
},
|
|
32
|
+
backHome() {
|
|
33
|
+
wx.navigateTo({ url: '/pages/index/index' })
|
|
34
|
+
},
|
|
35
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<view class="min-h-screen bg-slate-100 px-4 py-5">
|
|
2
|
+
<view class="rounded-2xl bg-white p-5 shadow-sm">
|
|
3
|
+
<view class="text-xs font-semibold uppercase tracking-[0.2em] text-rose-700">Native Layouts</view>
|
|
4
|
+
<view class="mt-3 text-2xl font-bold text-slate-900">Vant 原生模板已接入 layouts</view>
|
|
5
|
+
<view class="mt-3 text-sm leading-7 text-slate-600">当前状态:{{currentLayout}}</view>
|
|
6
|
+
</view>
|
|
7
|
+
|
|
8
|
+
<view class="mt-4 rounded-2xl bg-white p-5 shadow-sm">
|
|
9
|
+
<van-button type="primary" bind:tap="applyDefaultLayout">使用 default 布局</van-button>
|
|
10
|
+
<van-button custom-class="layout-btn" type="danger" plain bind:tap="applyAdminLayout">切到 admin 布局</van-button>
|
|
11
|
+
<van-button custom-class="layout-btn" type="default" plain bind:tap="clearLayout">关闭布局</van-button>
|
|
12
|
+
<van-button custom-class="layout-btn" type="success" plain bind:tap="showState">查看当前状态</van-button>
|
|
13
|
+
<van-button custom-class="layout-btn" type="default" bind:tap="backHome">返回首页</van-button>
|
|
14
|
+
</view>
|
|
15
|
+
|
|
16
|
+
<van-dialog id="van-dialog" />
|
|
17
|
+
</view>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"references": [
|
|
3
3
|
{
|
|
4
|
-
"path": "
|
|
4
|
+
"path": "./.weapp-vite/tsconfig.app.json"
|
|
5
5
|
},
|
|
6
6
|
{
|
|
7
|
-
"path": "
|
|
7
|
+
"path": "./.weapp-vite/tsconfig.server.json"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"path": "./.weapp-vite/tsconfig.node.json"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "./.weapp-vite/tsconfig.shared.json"
|
|
8
14
|
}
|
|
9
15
|
],
|
|
10
16
|
"files": []
|
|
@@ -5,6 +5,15 @@ import { defineConfig } from 'weapp-vite/config'
|
|
|
5
5
|
export default defineConfig({
|
|
6
6
|
weapp: {
|
|
7
7
|
srcRoot: 'src',
|
|
8
|
+
typescript: {
|
|
9
|
+
app: {
|
|
10
|
+
compilerOptions: {
|
|
11
|
+
paths: {
|
|
12
|
+
'@vant/weapp/*': ['./node_modules/@vant/weapp/dist/*'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
8
17
|
autoImportComponents: {
|
|
9
18
|
resolvers: [VantResolver()],
|
|
10
19
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite-wevu-template",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"private": true,
|
|
6
6
|
"description": "weapp-vite + wevu (Vue SFC) 模板",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"dev": "weapp-vite dev",
|
|
20
20
|
"dev:open": "weapp-vite dev -o",
|
|
21
21
|
"build": "weapp-vite build",
|
|
22
|
-
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json",
|
|
23
|
-
"open": "weapp-vite open"
|
|
22
|
+
"typecheck": "vue-tsc --noEmit -p .weapp-vite/tsconfig.app.json",
|
|
23
|
+
"open": "weapp-vite open",
|
|
24
|
+
"postinstall": "weapp-vite prepare"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"miniprogram-api-typings": "catalog:",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
3
3
|
"projectname": "weapp-vite-wevu-template",
|
|
4
4
|
"setting": {
|
|
5
|
-
"compileHotReLoad":
|
|
5
|
+
"compileHotReLoad": true
|
|
6
6
|
},
|
|
7
7
|
"libVersion": "3.13.0"
|
|
8
|
-
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
subtitle?: string
|
|
4
|
+
title?: string
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<view class="layout-admin">
|
|
10
|
+
<view class="layout-admin__hero">
|
|
11
|
+
<text class="layout-admin__eyebrow">
|
|
12
|
+
layouts/admin.vue
|
|
13
|
+
</text>
|
|
14
|
+
<text class="layout-admin__title">
|
|
15
|
+
{{ props.title || 'Admin Layout' }}
|
|
16
|
+
</text>
|
|
17
|
+
<text class="layout-admin__subtitle">
|
|
18
|
+
{{ props.subtitle || '页面内容通过默认 slot 注入到布局中。' }}
|
|
19
|
+
</text>
|
|
20
|
+
</view>
|
|
21
|
+
<view class="layout-admin__body">
|
|
22
|
+
<slot />
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.layout-admin {
|
|
29
|
+
min-height: 100%;
|
|
30
|
+
background:
|
|
31
|
+
radial-gradient(circle at top right, rgb(37 99 235 / 18%), transparent 32%),
|
|
32
|
+
linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.layout-admin__hero {
|
|
36
|
+
padding: 36rpx 32rpx 32rpx;
|
|
37
|
+
color: #fff;
|
|
38
|
+
background: linear-gradient(150deg, #0f172a 0%, #1d4ed8 62%, #60a5fa 100%);
|
|
39
|
+
border-radius: 0 0 28rpx 28rpx;
|
|
40
|
+
box-shadow: 0 18rpx 42rpx rgb(29 78 216 / 18%);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.layout-admin__eyebrow {
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
padding: 8rpx 16rpx;
|
|
46
|
+
font-size: 22rpx;
|
|
47
|
+
background: rgb(255 255 255 / 14%);
|
|
48
|
+
border-radius: 999rpx;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.layout-admin__title {
|
|
52
|
+
display: block;
|
|
53
|
+
margin-top: 18rpx;
|
|
54
|
+
font-size: 46rpx;
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.layout-admin__subtitle {
|
|
59
|
+
display: block;
|
|
60
|
+
margin-top: 12rpx;
|
|
61
|
+
font-size: 24rpx;
|
|
62
|
+
line-height: 1.7;
|
|
63
|
+
opacity: 0.92;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.layout-admin__body {
|
|
67
|
+
padding-bottom: 32rpx;
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
70
|
+
|
|
71
|
+
<json>
|
|
72
|
+
{
|
|
73
|
+
"component": true
|
|
74
|
+
}
|
|
75
|
+
</json>
|
|
@@ -10,6 +10,7 @@ const HOME_PATH = '/pages/index/index'
|
|
|
10
10
|
const OVERVIEW_PATH = '/pages/overview/index'
|
|
11
11
|
const WORKSPACE_PATH = '/packageA/pages/workspace/index'
|
|
12
12
|
const SETTINGS_PATH = '/packageB/pages/settings/index'
|
|
13
|
+
const LAYOUTS_PATH = '/pages/layouts/index'
|
|
13
14
|
|
|
14
15
|
const route = useRoute()
|
|
15
16
|
const router = useRouter()
|
|
@@ -40,6 +41,12 @@ const quickLinks = [
|
|
|
40
41
|
action: '前往设置',
|
|
41
42
|
path: SETTINGS_PATH,
|
|
42
43
|
},
|
|
44
|
+
{
|
|
45
|
+
title: '页面布局',
|
|
46
|
+
description: '体验 default/admin/false 三种页面壳切换方式。',
|
|
47
|
+
action: '打开布局页',
|
|
48
|
+
path: LAYOUTS_PATH,
|
|
49
|
+
},
|
|
43
50
|
]
|
|
44
51
|
|
|
45
52
|
async function pushTo(path: string) {
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, setPageLayout } from 'wevu'
|
|
3
|
+
import { useRouter } from 'wevu/router'
|
|
4
|
+
|
|
5
|
+
definePageJson({
|
|
6
|
+
navigationBarTitleText: '页面布局',
|
|
7
|
+
})
|
|
8
|
+
|
|
9
|
+
const router = useRouter()
|
|
10
|
+
const currentLayout = ref<'default' | 'admin' | 'none'>('default')
|
|
11
|
+
|
|
12
|
+
const cards = [
|
|
13
|
+
{
|
|
14
|
+
title: 'default 布局',
|
|
15
|
+
desc: '当前页面默认命中 src/layouts/default.vue,适合作为轻量通用外壳。',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
title: 'admin 布局',
|
|
19
|
+
desc: '点击按钮后会调用 setPageLayout(\'admin\') 切到命名布局,同时传入标题与说明。',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
title: '关闭布局',
|
|
23
|
+
desc: '也可以通过 setPageLayout(false) 临时移除页面壳,让页面恢复为原始根结构。',
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
function applyDefaultLayout() {
|
|
28
|
+
currentLayout.value = 'default'
|
|
29
|
+
setPageLayout('default')
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function applyAdminLayout() {
|
|
33
|
+
currentLayout.value = 'admin'
|
|
34
|
+
setPageLayout('admin', {
|
|
35
|
+
title: '业务后台布局',
|
|
36
|
+
subtitle: '这个标题来自 setPageLayout() 传入的 props。',
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function clearLayout() {
|
|
41
|
+
currentLayout.value = 'none'
|
|
42
|
+
setPageLayout(false)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function backHome() {
|
|
46
|
+
await router.push('/pages/index/index')
|
|
47
|
+
}
|
|
48
|
+
</script>
|
|
49
|
+
|
|
50
|
+
<template>
|
|
51
|
+
<view class="page">
|
|
52
|
+
<view class="hero">
|
|
53
|
+
<view class="hero__eyebrow">
|
|
54
|
+
Layout Playground
|
|
55
|
+
</view>
|
|
56
|
+
<view class="hero__title">
|
|
57
|
+
基础模板已接入 src/layouts 约定
|
|
58
|
+
</view>
|
|
59
|
+
<view class="hero__desc">
|
|
60
|
+
当前状态:{{ currentLayout }}。可以在 default、admin 与 false 三种布局模式之间切换,作为正式业务页面的基础壳能力。
|
|
61
|
+
</view>
|
|
62
|
+
</view>
|
|
63
|
+
|
|
64
|
+
<view
|
|
65
|
+
v-for="item in cards"
|
|
66
|
+
:key="item.title"
|
|
67
|
+
class="section"
|
|
68
|
+
>
|
|
69
|
+
<view class="section__title">
|
|
70
|
+
{{ item.title }}
|
|
71
|
+
</view>
|
|
72
|
+
<text class="section__desc">
|
|
73
|
+
{{ item.desc }}
|
|
74
|
+
</text>
|
|
75
|
+
</view>
|
|
76
|
+
|
|
77
|
+
<view class="section">
|
|
78
|
+
<button class="action-btn" @tap="applyDefaultLayout">
|
|
79
|
+
使用 default 布局
|
|
80
|
+
</button>
|
|
81
|
+
<button class="action-btn action-btn--primary" @tap="applyAdminLayout">
|
|
82
|
+
切到 admin 布局
|
|
83
|
+
</button>
|
|
84
|
+
<button class="action-btn action-btn--ghost" @tap="clearLayout">
|
|
85
|
+
关闭布局
|
|
86
|
+
</button>
|
|
87
|
+
<button class="action-btn action-btn--light" @tap="backHome">
|
|
88
|
+
返回首页
|
|
89
|
+
</button>
|
|
90
|
+
</view>
|
|
91
|
+
</view>
|
|
92
|
+
</template>
|
|
93
|
+
|
|
94
|
+
<style>
|
|
95
|
+
.page {
|
|
96
|
+
box-sizing: border-box;
|
|
97
|
+
min-height: 100vh;
|
|
98
|
+
padding: 28rpx 28rpx 40rpx;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.hero,
|
|
102
|
+
.section {
|
|
103
|
+
padding: 28rpx;
|
|
104
|
+
margin-top: 20rpx;
|
|
105
|
+
background: rgb(255 255 255 / 92%);
|
|
106
|
+
border: 2rpx solid rgb(226 232 240 / 88%);
|
|
107
|
+
border-radius: 28rpx;
|
|
108
|
+
box-shadow: 0 12rpx 32rpx rgb(15 23 42 / 4%);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.hero {
|
|
112
|
+
margin-top: 0;
|
|
113
|
+
background: linear-gradient(160deg, #eff6ff 0%, #dbeafe 100%);
|
|
114
|
+
border-color: #bfdbfe;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.hero__eyebrow {
|
|
118
|
+
font-size: 22rpx;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
color: #1d4ed8;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.hero__title {
|
|
124
|
+
margin-top: 12rpx;
|
|
125
|
+
font-size: 40rpx;
|
|
126
|
+
font-weight: 700;
|
|
127
|
+
color: #0f172a;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.hero__desc,
|
|
131
|
+
.section__desc {
|
|
132
|
+
display: block;
|
|
133
|
+
margin-top: 12rpx;
|
|
134
|
+
font-size: 24rpx;
|
|
135
|
+
line-height: 1.7;
|
|
136
|
+
color: #475569;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.section__title {
|
|
140
|
+
font-size: 28rpx;
|
|
141
|
+
font-weight: 700;
|
|
142
|
+
color: #0f172a;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.action-btn {
|
|
146
|
+
margin-top: 16rpx;
|
|
147
|
+
color: #fff;
|
|
148
|
+
background: #0f172a;
|
|
149
|
+
border-radius: 999rpx;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.action-btn--primary {
|
|
153
|
+
background: #2563eb;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.action-btn--ghost {
|
|
157
|
+
color: #0f172a;
|
|
158
|
+
background: #e2e8f0;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.action-btn--light {
|
|
162
|
+
color: #1d4ed8;
|
|
163
|
+
background: #dbeafe;
|
|
164
|
+
}
|
|
165
|
+
</style>
|
|
166
|
+
|
|
167
|
+
<json>
|
|
168
|
+
{
|
|
169
|
+
"navigationBarTitleText": "页面布局"
|
|
170
|
+
}
|
|
171
|
+
</json>
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"references": [
|
|
3
3
|
{
|
|
4
|
-
"path": "
|
|
4
|
+
"path": "./.weapp-vite/tsconfig.app.json"
|
|
5
5
|
},
|
|
6
6
|
{
|
|
7
|
-
"path": "
|
|
7
|
+
"path": "./.weapp-vite/tsconfig.server.json"
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"path": "./.weapp-vite/tsconfig.node.json"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"path": "./.weapp-vite/tsconfig.shared.json"
|
|
8
14
|
}
|
|
9
15
|
],
|
|
10
16
|
"files": []
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite-wevu-tailwindcss-tdesign-template",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"private": true,
|
|
6
6
|
"description": "weapp-vite + wevu (Vue SFC) 模板",
|
|
7
7
|
"author": "ice breaker <1324318532@qq.com>",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"dev": "weapp-vite dev",
|
|
20
20
|
"dev:open": "weapp-vite dev -o",
|
|
21
21
|
"build": "weapp-vite build",
|
|
22
|
-
"typecheck": "vue-tsc --noEmit -p tsconfig.app.json",
|
|
22
|
+
"typecheck": "vue-tsc --noEmit -p .weapp-vite/tsconfig.app.json",
|
|
23
23
|
"open": "weapp-vite open",
|
|
24
|
-
"postinstall": "weapp-tw patch"
|
|
24
|
+
"postinstall": "weapp-tw patch && weapp-vite prepare"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"tdesign-miniprogram": "catalog:"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"miniprogram-api-typings": "catalog:",
|
|
34
34
|
"postcss": "catalog:",
|
|
35
35
|
"sass": "catalog:",
|
|
36
|
-
"tailwindcss": "catalog:",
|
|
36
|
+
"tailwindcss": "catalog:tailwind3",
|
|
37
37
|
"typescript": "catalog:",
|
|
38
38
|
"vue-tsc": "catalog:",
|
|
39
39
|
"weapp-tailwindcss": "catalog:",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
3
3
|
"projectname": "weapp-vite-wevu-tailwindcss-tdesign-template",
|
|
4
4
|
"setting": {
|
|
5
|
-
"compileHotReLoad":
|
|
5
|
+
"compileHotReLoad": true
|
|
6
6
|
},
|
|
7
7
|
"condition": {
|
|
8
8
|
"miniprogram": {
|
|
@@ -18,12 +18,6 @@ const props = withDefaults(defineProps<{
|
|
|
18
18
|
columns: 2,
|
|
19
19
|
})
|
|
20
20
|
|
|
21
|
-
console.log('props', JSON.stringify(props))
|
|
22
|
-
|
|
23
|
-
defineComponentJson({
|
|
24
|
-
styleIsolation: 'apply-shared',
|
|
25
|
-
})
|
|
26
|
-
|
|
27
21
|
type KpiTone = 'positive' | 'negative' | 'neutral'
|
|
28
22
|
|
|
29
23
|
export interface KpiItem {
|
|
@@ -35,6 +29,10 @@ export interface KpiItem {
|
|
|
35
29
|
footnote?: string
|
|
36
30
|
}
|
|
37
31
|
|
|
32
|
+
defineComponentJson({
|
|
33
|
+
styleIsolation: 'apply-shared',
|
|
34
|
+
})
|
|
35
|
+
|
|
38
36
|
function resolveTone(delta?: number): KpiTone {
|
|
39
37
|
if (delta === undefined || Number.isNaN(delta)) {
|
|
40
38
|
return 'neutral'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = defineProps<{
|
|
3
|
+
subtitle?: string
|
|
4
|
+
title?: string
|
|
5
|
+
}>()
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<template>
|
|
9
|
+
<view class="layout-admin min-h-full bg-[linear-gradient(180deg,#f8f7ff_0%,#f1efff_100%)]">
|
|
10
|
+
<view class="rounded-b-[32rpx] bg-[linear-gradient(145deg,#2f2b5f_0%,#4b3fb8_64%,#8b7bff_100%)] px-[32rpx] pb-[32rpx] pt-[36rpx] text-white shadow-[0_18rpx_42rpx_rgba(75,63,184,0.18)]">
|
|
11
|
+
<text class="inline-flex rounded-full bg-white/15 px-[16rpx] py-[8rpx] text-[22rpx]">
|
|
12
|
+
layouts/admin.vue
|
|
13
|
+
</text>
|
|
14
|
+
<text class="mt-[18rpx] block text-[46rpx] font-semibold">
|
|
15
|
+
{{ props.title || 'Admin Layout' }}
|
|
16
|
+
</text>
|
|
17
|
+
<text class="mt-[12rpx] block text-[24rpx] leading-[1.7] text-white/90">
|
|
18
|
+
{{ props.subtitle || '页面内容通过默认 slot 注入到布局中。' }}
|
|
19
|
+
</text>
|
|
20
|
+
</view>
|
|
21
|
+
<view class="pb-[32rpx]">
|
|
22
|
+
<slot />
|
|
23
|
+
</view>
|
|
24
|
+
</view>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.layout-admin {
|
|
29
|
+
min-height: 100%;
|
|
30
|
+
}
|
|
31
|
+
</style>
|
|
32
|
+
|
|
33
|
+
<json>
|
|
34
|
+
{
|
|
35
|
+
"component": true
|
|
36
|
+
}
|
|
37
|
+
</json>
|