@weapp-core/init 4.1.0 → 4.1.1
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/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/templates/tailwindcss/tailwind.config.ts +2 -2
- package/templates/tdesign/tailwind.config.ts +2 -2
- package/templates/vant/tailwind.config.ts +2 -2
- package/templates/wevu-tdesign/src/app.vue +4 -9
- package/templates/wevu-tdesign/src/components/HelloWorld/index.vue +3 -25
- package/templates/wevu-tdesign/src/pages/index/index.vue +123 -96
- package/templates/wevu-tdesign/tailwind.config.ts +2 -2
- package/templates/wevu-tdesign/tsconfig.app.json +3 -1
package/dist/index.cjs
CHANGED
|
@@ -768,7 +768,7 @@ var import_logger3 = __toESM(require("@weapp-core/logger"), 1);
|
|
|
768
768
|
var import_fs_extra2 = __toESM(require("fs-extra"), 1);
|
|
769
769
|
|
|
770
770
|
// ../../packages/weapp-vite/package.json
|
|
771
|
-
var version = "6.1.
|
|
771
|
+
var version = "6.1.3";
|
|
772
772
|
|
|
773
773
|
// ../../packages/wevu/package.json
|
|
774
774
|
var version2 = "1.0.1";
|
package/dist/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Config } from 'tailwindcss'
|
|
2
2
|
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons'
|
|
3
3
|
|
|
4
|
-
export default
|
|
4
|
+
export default {
|
|
5
5
|
content: [
|
|
6
6
|
// 添加你需要提取的文件目录
|
|
7
7
|
'src/**/*.{wxml,js,ts}',
|
|
@@ -19,4 +19,4 @@ export default <Config>{
|
|
|
19
19
|
preflight: false,
|
|
20
20
|
container: false,
|
|
21
21
|
},
|
|
22
|
-
}
|
|
22
|
+
} satisfies Config
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Config } from 'tailwindcss'
|
|
2
2
|
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons'
|
|
3
3
|
|
|
4
|
-
export default
|
|
4
|
+
export default {
|
|
5
5
|
content: [
|
|
6
6
|
// 添加你需要提取的文件目录
|
|
7
7
|
'src/**/*.{wxml,js,ts}',
|
|
@@ -19,4 +19,4 @@ export default <Config>{
|
|
|
19
19
|
preflight: false,
|
|
20
20
|
container: false,
|
|
21
21
|
},
|
|
22
|
-
}
|
|
22
|
+
} satisfies Config
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Config } from 'tailwindcss'
|
|
2
2
|
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons'
|
|
3
3
|
|
|
4
|
-
export default
|
|
4
|
+
export default {
|
|
5
5
|
content: [
|
|
6
6
|
// 添加你需要提取的文件目录
|
|
7
7
|
'src/**/*.{wxml,js,ts}',
|
|
@@ -19,4 +19,4 @@ export default <Config>{
|
|
|
19
19
|
preflight: false,
|
|
20
20
|
container: false,
|
|
21
21
|
},
|
|
22
|
-
}
|
|
22
|
+
} satisfies Config
|
|
@@ -28,13 +28,8 @@ onLaunch(() => {
|
|
|
28
28
|
})
|
|
29
29
|
</script>
|
|
30
30
|
|
|
31
|
-
<style
|
|
32
|
-
@
|
|
33
|
-
@
|
|
34
|
-
@
|
|
35
|
-
|
|
36
|
-
page {
|
|
37
|
-
color: #1c1c3c;
|
|
38
|
-
background: #f6f7fb;
|
|
39
|
-
}
|
|
31
|
+
<style>
|
|
32
|
+
@tailwind base;
|
|
33
|
+
@tailwind components;
|
|
34
|
+
@tailwind utilities;
|
|
40
35
|
</style>
|
|
@@ -12,34 +12,12 @@ const props = withDefaults(
|
|
|
12
12
|
</script>
|
|
13
13
|
|
|
14
14
|
<template>
|
|
15
|
-
<view class="
|
|
16
|
-
<text class="
|
|
15
|
+
<view class="rounded-[24rpx] bg-gradient-to-br from-[#4c6ef5] to-[#7048e8] p-[24rpx]">
|
|
16
|
+
<text class="block text-[40rpx] font-bold text-white">
|
|
17
17
|
{{ props.title }}
|
|
18
18
|
</text>
|
|
19
|
-
<text v-if="props.subtitle" class="
|
|
19
|
+
<text v-if="props.subtitle" class="mt-[8rpx] block text-[26rpx] text-white/85">
|
|
20
20
|
{{ props.subtitle }}
|
|
21
21
|
</text>
|
|
22
22
|
</view>
|
|
23
23
|
</template>
|
|
24
|
-
|
|
25
|
-
<style>
|
|
26
|
-
.header {
|
|
27
|
-
padding: 24rpx;
|
|
28
|
-
background: linear-gradient(135deg, #4c6ef5, #7048e8);
|
|
29
|
-
border-radius: 24rpx;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.title {
|
|
33
|
-
display: block;
|
|
34
|
-
font-size: 40rpx;
|
|
35
|
-
font-weight: 700;
|
|
36
|
-
color: #fff;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.subtitle {
|
|
40
|
-
display: block;
|
|
41
|
-
margin-top: 8rpx;
|
|
42
|
-
font-size: 26rpx;
|
|
43
|
-
color: rgb(255 255 255 / 85%);
|
|
44
|
-
}
|
|
45
|
-
</style>
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import Dialog from 'tdesign-miniprogram/dialog/index'
|
|
3
|
+
import Toast from 'tdesign-miniprogram/toast/index'
|
|
4
|
+
|
|
5
|
+
import { computed, getCurrentInstance, ref, watch } from 'wevu'
|
|
3
6
|
|
|
4
7
|
import HelloWorld from '@/components/HelloWorld/index.vue'
|
|
5
8
|
|
|
@@ -7,6 +10,8 @@ definePageJson({
|
|
|
7
10
|
navigationBarTitleText: '首页',
|
|
8
11
|
})
|
|
9
12
|
|
|
13
|
+
const mpContext = getCurrentInstance()
|
|
14
|
+
|
|
10
15
|
const count = ref(0)
|
|
11
16
|
const message = ref('Hello WeVU!')
|
|
12
17
|
const todos = ref([
|
|
@@ -14,125 +19,147 @@ const todos = ref([
|
|
|
14
19
|
'用 wevu API(ref/computed/watch)写逻辑',
|
|
15
20
|
'用 v-for / v-if / @tap / v-model 写模板',
|
|
16
21
|
])
|
|
22
|
+
const checkedTodos = ref<Array<string | number>>([])
|
|
23
|
+
const newTodo = ref('')
|
|
17
24
|
|
|
18
25
|
const doubled = computed(() => count.value * 2)
|
|
26
|
+
const todoOptions = computed(() =>
|
|
27
|
+
todos.value.map((todo, index) => ({
|
|
28
|
+
label: todo,
|
|
29
|
+
value: index,
|
|
30
|
+
})),
|
|
31
|
+
)
|
|
32
|
+
const checkedCount = computed(() => checkedTodos.value.length)
|
|
33
|
+
|
|
34
|
+
function showToast(options: Parameters<typeof Toast>[0]) {
|
|
35
|
+
if (!mpContext) {
|
|
36
|
+
return
|
|
37
|
+
}
|
|
38
|
+
Toast({
|
|
39
|
+
selector: '#t-toast',
|
|
40
|
+
...options,
|
|
41
|
+
context: mpContext as any,
|
|
42
|
+
})
|
|
43
|
+
}
|
|
19
44
|
|
|
20
45
|
function increment() {
|
|
21
46
|
count.value += 1
|
|
47
|
+
showToast({
|
|
48
|
+
theme: 'success',
|
|
49
|
+
message: `+1,当前:${count.value}`,
|
|
50
|
+
duration: 1200,
|
|
51
|
+
})
|
|
22
52
|
}
|
|
23
53
|
|
|
24
|
-
function reset() {
|
|
25
|
-
|
|
54
|
+
async function reset() {
|
|
55
|
+
if (!mpContext) {
|
|
56
|
+
count.value = 0
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
await Dialog.confirm({
|
|
62
|
+
context: mpContext as any,
|
|
63
|
+
selector: '#t-dialog',
|
|
64
|
+
title: '重置计数器',
|
|
65
|
+
content: `当前计数为 ${count.value},确定要重置吗?`,
|
|
66
|
+
confirmButtonText: '重置',
|
|
67
|
+
cancelButtonText: '取消',
|
|
68
|
+
})
|
|
69
|
+
count.value = 0
|
|
70
|
+
showToast({ theme: 'success', message: '已重置', duration: 1200 })
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
showToast({ theme: 'warning', message: '已取消', duration: 1000 })
|
|
74
|
+
}
|
|
26
75
|
}
|
|
27
76
|
|
|
28
77
|
watch(count, (newValue, oldValue) => {
|
|
29
78
|
console.log(`[wevu] count changed: ${oldValue} -> ${newValue}`)
|
|
30
79
|
})
|
|
80
|
+
|
|
81
|
+
function onMessageChange(e: WechatMiniprogram.CustomEvent<{ value: string }>) {
|
|
82
|
+
message.value = e.detail.value
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function onNewTodoChange(e: WechatMiniprogram.CustomEvent<{ value: string }>) {
|
|
86
|
+
newTodo.value = e.detail.value
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function addTodo() {
|
|
90
|
+
const value = newTodo.value.trim()
|
|
91
|
+
if (!value) {
|
|
92
|
+
showToast({ theme: 'warning', message: '请输入内容', duration: 1000 })
|
|
93
|
+
return
|
|
94
|
+
}
|
|
95
|
+
todos.value.push(value)
|
|
96
|
+
newTodo.value = ''
|
|
97
|
+
showToast({ theme: 'success', message: '已添加', duration: 1000 })
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
function onTodoChange(e: WechatMiniprogram.CustomEvent<{ value: Array<string | number> }>) {
|
|
101
|
+
checkedTodos.value = e.detail.value
|
|
102
|
+
}
|
|
31
103
|
</script>
|
|
32
104
|
|
|
33
105
|
<template>
|
|
34
|
-
<view class="
|
|
106
|
+
<view class="box-border min-h-screen bg-[#f6f7fb] px-[32rpx] pb-[64rpx] pt-[48rpx] text-[#1c1c3c]">
|
|
35
107
|
<HelloWorld :title="message" :subtitle="`count=${count}, doubled=${doubled}`" />
|
|
36
108
|
|
|
37
|
-
<view
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
109
|
+
<view
|
|
110
|
+
class="mt-[24rpx] rounded-[24rpx] bg-white p-[32rpx] shadow-[0_12rpx_32rpx_rgb(44_44_84_/_10%)]"
|
|
111
|
+
>
|
|
112
|
+
<t-cell-group title="计数器" theme="card">
|
|
113
|
+
<t-cell title="当前计数" :note="String(count)" />
|
|
114
|
+
<t-cell title="双倍" :note="String(doubled)" />
|
|
115
|
+
</t-cell-group>
|
|
116
|
+
|
|
117
|
+
<view class="mt-[24rpx] flex gap-[16rpx]">
|
|
118
|
+
<view class="flex-1">
|
|
119
|
+
<t-button block size="large" theme="primary" @tap="increment">
|
|
120
|
+
+1
|
|
121
|
+
</t-button>
|
|
122
|
+
</view>
|
|
123
|
+
<view class="flex-1">
|
|
124
|
+
<t-button block size="large" theme="danger" variant="outline" @tap="reset">
|
|
125
|
+
重置
|
|
126
|
+
</t-button>
|
|
127
|
+
</view>
|
|
45
128
|
</view>
|
|
46
129
|
|
|
47
|
-
<view class="
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
130
|
+
<view class="mt-[24rpx]">
|
|
131
|
+
<t-input
|
|
132
|
+
label="标题"
|
|
133
|
+
placeholder="输入标题…"
|
|
134
|
+
clearable
|
|
135
|
+
:value="message"
|
|
136
|
+
@change="onMessageChange"
|
|
137
|
+
/>
|
|
54
138
|
</view>
|
|
55
139
|
|
|
56
|
-
<view class="
|
|
57
|
-
<
|
|
58
|
-
|
|
59
|
-
|
|
140
|
+
<view class="mt-[24rpx]">
|
|
141
|
+
<t-input
|
|
142
|
+
label="新增待办"
|
|
143
|
+
placeholder="输入一条待办…"
|
|
144
|
+
clearable
|
|
145
|
+
:value="newTodo"
|
|
146
|
+
@change="onNewTodoChange"
|
|
147
|
+
/>
|
|
148
|
+
<view class="mt-[16rpx]">
|
|
149
|
+
<t-button block size="large" theme="primary" variant="dashed" @tap="addTodo">
|
|
150
|
+
添加
|
|
151
|
+
</t-button>
|
|
152
|
+
</view>
|
|
60
153
|
</view>
|
|
61
|
-
<input v-model="message" class="input" placeholder="输入标题…">
|
|
62
154
|
|
|
63
|
-
<view class="
|
|
64
|
-
<
|
|
65
|
-
|
|
66
|
-
</
|
|
67
|
-
</view>
|
|
68
|
-
<view class="todo">
|
|
69
|
-
<view v-for="(todo, index) in todos" :key="index" class="todo-item">
|
|
70
|
-
<text>• {{ todo }}</text>
|
|
71
|
-
</view>
|
|
155
|
+
<view class="mt-[24rpx]">
|
|
156
|
+
<t-cell-group :title="`Checklist(已完成 ${checkedCount}/${todos.length})`" theme="card">
|
|
157
|
+
<t-checkbox-group :options="todoOptions" :value="checkedTodos" @change="onTodoChange" />
|
|
158
|
+
</t-cell-group>
|
|
72
159
|
</view>
|
|
73
160
|
</view>
|
|
161
|
+
|
|
162
|
+
<t-toast id="t-toast" />
|
|
163
|
+
<t-dialog id="t-dialog" />
|
|
74
164
|
</view>
|
|
75
165
|
</template>
|
|
76
|
-
|
|
77
|
-
<style>
|
|
78
|
-
.page {
|
|
79
|
-
box-sizing: border-box;
|
|
80
|
-
padding: 48rpx 32rpx 64rpx;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.card {
|
|
84
|
-
padding: 32rpx;
|
|
85
|
-
margin-top: 24rpx;
|
|
86
|
-
background: #fff;
|
|
87
|
-
border-radius: 24rpx;
|
|
88
|
-
box-shadow: 0 12rpx 32rpx rgb(44 44 84 / 10%);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.row {
|
|
92
|
-
display: flex;
|
|
93
|
-
gap: 16rpx;
|
|
94
|
-
align-items: center;
|
|
95
|
-
justify-content: space-between;
|
|
96
|
-
margin-bottom: 16rpx;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.label {
|
|
100
|
-
font-size: 30rpx;
|
|
101
|
-
color: #1c1c3c;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.actions {
|
|
105
|
-
margin: 24rpx 0;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.btn {
|
|
109
|
-
flex: 1;
|
|
110
|
-
line-height: 96rpx;
|
|
111
|
-
color: #fff;
|
|
112
|
-
border-radius: 16rpx;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.btn.primary {
|
|
116
|
-
background: #4c6ef5;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.btn.danger {
|
|
120
|
-
background: #f03e3e;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.input {
|
|
124
|
-
box-sizing: border-box;
|
|
125
|
-
height: 88rpx;
|
|
126
|
-
padding: 0 24rpx;
|
|
127
|
-
margin: 0 0 24rpx;
|
|
128
|
-
background: #fff;
|
|
129
|
-
border: 2rpx solid #e9ecef;
|
|
130
|
-
border-radius: 16rpx;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.todo-item {
|
|
134
|
-
margin-bottom: 12rpx;
|
|
135
|
-
font-size: 26rpx;
|
|
136
|
-
color: #4f4f7a;
|
|
137
|
-
}
|
|
138
|
-
</style>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Config } from 'tailwindcss'
|
|
2
2
|
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons'
|
|
3
3
|
|
|
4
|
-
export default
|
|
4
|
+
export default {
|
|
5
5
|
content: [
|
|
6
6
|
// 添加你需要提取的文件目录
|
|
7
7
|
'src/**/*.{wxml,js,ts,vue}',
|
|
@@ -19,4 +19,4 @@ export default <Config>{
|
|
|
19
19
|
preflight: false,
|
|
20
20
|
container: false,
|
|
21
21
|
},
|
|
22
|
-
}
|
|
22
|
+
} satisfies Config
|