@weapp-core/init 4.0.1 → 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 +2 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -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/src/app.vue +6 -6
- package/templates/wevu/src/components/HelloWorld/index.vue +10 -7
- package/templates/wevu-tdesign/.editorconfig +9 -0
- package/templates/wevu-tdesign/.vscode/settings.json +5 -0
- package/templates/wevu-tdesign/README.md +29 -0
- package/templates/wevu-tdesign/auto-import-components.json +83 -0
- package/templates/wevu-tdesign/components.d.ts +183 -0
- package/templates/wevu-tdesign/gitignore +35 -0
- package/templates/wevu-tdesign/package.json +40 -0
- package/templates/wevu-tdesign/postcss.config.js +6 -0
- package/templates/wevu-tdesign/project.config.json +43 -0
- package/templates/wevu-tdesign/project.private.config.json +8 -0
- package/templates/wevu-tdesign/public/logo.png +0 -0
- package/templates/wevu-tdesign/src/app.vue +35 -0
- package/templates/wevu-tdesign/src/components/HelloWorld/index.vue +23 -0
- package/templates/wevu-tdesign/src/pages/index/index.vue +165 -0
- package/templates/wevu-tdesign/src/sitemap.json +10 -0
- package/templates/wevu-tdesign/src/theme.json +5 -0
- package/templates/wevu-tdesign/src/vite-env.d.ts +1 -0
- package/templates/wevu-tdesign/tailwind.config.ts +22 -0
- package/templates/wevu-tdesign/tsconfig.app.json +62 -0
- package/templates/wevu-tdesign/tsconfig.json +11 -0
- package/templates/wevu-tdesign/tsconfig.node.json +33 -0
- package/templates/wevu-tdesign/typed-components.d.ts +943 -0
- package/templates/wevu-tdesign/vite.config.ts +43 -0
- package/templates/wevu/.changeset/bright-kings-sneeze.md +0 -10
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
3
|
+
"projectname": "weapp-vite-wevu-template",
|
|
4
|
+
"setting": {
|
|
5
|
+
"compileHotReLoad": true
|
|
6
|
+
},
|
|
7
|
+
"libVersion": "3.13.0"
|
|
8
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onHide, onLaunch, onShow } from 'wevu'
|
|
3
|
+
|
|
4
|
+
defineAppJson({
|
|
5
|
+
pages: [
|
|
6
|
+
'pages/index/index',
|
|
7
|
+
],
|
|
8
|
+
window: {
|
|
9
|
+
navigationBarTitleText: 'Wepp-Vite + WeVU Template',
|
|
10
|
+
navigationBarBackgroundColor: '#4c6ef5',
|
|
11
|
+
navigationBarTextStyle: 'white',
|
|
12
|
+
},
|
|
13
|
+
style: 'v2',
|
|
14
|
+
componentFramework: 'glass-easel',
|
|
15
|
+
sitemapLocation: 'sitemap.json',
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
onShow(() => {
|
|
19
|
+
console.log('[weapp-vite-wevu-template] app show')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
onHide(() => {
|
|
23
|
+
console.log('[weapp-vite-wevu-template] app hide')
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
onLaunch(() => {
|
|
27
|
+
console.log('[weapp-vite-wevu-template] app launch')
|
|
28
|
+
})
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
@tailwind base;
|
|
33
|
+
@tailwind components;
|
|
34
|
+
@tailwind utilities;
|
|
35
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const props = withDefaults(
|
|
3
|
+
defineProps<{
|
|
4
|
+
title?: string
|
|
5
|
+
subtitle?: string
|
|
6
|
+
}>(),
|
|
7
|
+
{
|
|
8
|
+
title: 'Hello WeVU',
|
|
9
|
+
subtitle: '',
|
|
10
|
+
},
|
|
11
|
+
)
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<template>
|
|
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
|
+
{{ props.title }}
|
|
18
|
+
</text>
|
|
19
|
+
<text v-if="props.subtitle" class="mt-[8rpx] block text-[26rpx] text-white/85">
|
|
20
|
+
{{ props.subtitle }}
|
|
21
|
+
</text>
|
|
22
|
+
</view>
|
|
23
|
+
</template>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
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'
|
|
6
|
+
|
|
7
|
+
import HelloWorld from '@/components/HelloWorld/index.vue'
|
|
8
|
+
|
|
9
|
+
definePageJson({
|
|
10
|
+
navigationBarTitleText: '首页',
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
const mpContext = getCurrentInstance()
|
|
14
|
+
|
|
15
|
+
const count = ref(0)
|
|
16
|
+
const message = ref('Hello WeVU!')
|
|
17
|
+
const todos = ref([
|
|
18
|
+
'用 Vue SFC 写页面/组件',
|
|
19
|
+
'用 wevu API(ref/computed/watch)写逻辑',
|
|
20
|
+
'用 v-for / v-if / @tap / v-model 写模板',
|
|
21
|
+
])
|
|
22
|
+
const checkedTodos = ref<Array<string | number>>([])
|
|
23
|
+
const newTodo = ref('')
|
|
24
|
+
|
|
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
|
+
}
|
|
44
|
+
|
|
45
|
+
function increment() {
|
|
46
|
+
count.value += 1
|
|
47
|
+
showToast({
|
|
48
|
+
theme: 'success',
|
|
49
|
+
message: `+1,当前:${count.value}`,
|
|
50
|
+
duration: 1200,
|
|
51
|
+
})
|
|
52
|
+
}
|
|
53
|
+
|
|
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
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
watch(count, (newValue, oldValue) => {
|
|
78
|
+
console.log(`[wevu] count changed: ${oldValue} -> ${newValue}`)
|
|
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
|
+
}
|
|
103
|
+
</script>
|
|
104
|
+
|
|
105
|
+
<template>
|
|
106
|
+
<view class="box-border min-h-screen bg-[#f6f7fb] px-[32rpx] pb-[64rpx] pt-[48rpx] text-[#1c1c3c]">
|
|
107
|
+
<HelloWorld :title="message" :subtitle="`count=${count}, doubled=${doubled}`" />
|
|
108
|
+
|
|
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>
|
|
128
|
+
</view>
|
|
129
|
+
|
|
130
|
+
<view class="mt-[24rpx]">
|
|
131
|
+
<t-input
|
|
132
|
+
label="标题"
|
|
133
|
+
placeholder="输入标题…"
|
|
134
|
+
clearable
|
|
135
|
+
:value="message"
|
|
136
|
+
@change="onMessageChange"
|
|
137
|
+
/>
|
|
138
|
+
</view>
|
|
139
|
+
|
|
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>
|
|
153
|
+
</view>
|
|
154
|
+
|
|
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>
|
|
159
|
+
</view>
|
|
160
|
+
</view>
|
|
161
|
+
|
|
162
|
+
<t-toast id="t-toast" />
|
|
163
|
+
<t-dialog id="t-dialog" />
|
|
164
|
+
</view>
|
|
165
|
+
</template>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="weapp-vite/client" />
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Config } from 'tailwindcss'
|
|
2
|
+
import { getIconCollections, iconsPlugin } from '@egoist/tailwindcss-icons'
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
content: [
|
|
6
|
+
// 添加你需要提取的文件目录
|
|
7
|
+
'src/**/*.{wxml,js,ts,vue}',
|
|
8
|
+
],
|
|
9
|
+
theme: {
|
|
10
|
+
extend: {},
|
|
11
|
+
},
|
|
12
|
+
plugins: [
|
|
13
|
+
iconsPlugin({
|
|
14
|
+
collections: getIconCollections(['mdi']),
|
|
15
|
+
}),
|
|
16
|
+
],
|
|
17
|
+
corePlugins: {
|
|
18
|
+
// 小程序不需要 preflight 和 container,因为这主要是给 h5 的,如果你要同时开发小程序和 h5 端,你应该使用环境变量来控制它
|
|
19
|
+
preflight: false,
|
|
20
|
+
container: false,
|
|
21
|
+
},
|
|
22
|
+
} satisfies Config
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.app.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"jsx": "preserve",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2023",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
"baseUrl": ".",
|
|
13
|
+
"module": "ESNext",
|
|
14
|
+
"moduleResolution": "bundler",
|
|
15
|
+
"paths": {
|
|
16
|
+
"@/*": [
|
|
17
|
+
"./src/*"
|
|
18
|
+
],
|
|
19
|
+
"take:@/*": [
|
|
20
|
+
"./src/*"
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
"resolveJsonModule": true,
|
|
24
|
+
"types": [
|
|
25
|
+
"miniprogram-api-typings"
|
|
26
|
+
],
|
|
27
|
+
"allowImportingTsExtensions": true,
|
|
28
|
+
"allowJs": true,
|
|
29
|
+
"strict": true,
|
|
30
|
+
"noFallthroughCasesInSwitch": true,
|
|
31
|
+
"noUnusedLocals": true,
|
|
32
|
+
"noUnusedParameters": true,
|
|
33
|
+
"noEmit": true,
|
|
34
|
+
"allowSyntheticDefaultImports": true,
|
|
35
|
+
"esModuleInterop": true,
|
|
36
|
+
"isolatedModules": true,
|
|
37
|
+
"verbatimModuleSyntax": true,
|
|
38
|
+
"noUncheckedSideEffectImports": true,
|
|
39
|
+
"erasableSyntaxOnly": true,
|
|
40
|
+
"skipLibCheck": true
|
|
41
|
+
},
|
|
42
|
+
"vueCompilerOptions": {
|
|
43
|
+
"plugins": [
|
|
44
|
+
"weapp-vite/volar"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"include": [
|
|
48
|
+
"src/**/*.ts",
|
|
49
|
+
"src/**/*.tsx",
|
|
50
|
+
"src/**/*.js",
|
|
51
|
+
"src/**/*.jsx",
|
|
52
|
+
"src/**/*.mts",
|
|
53
|
+
"src/**/*.cts",
|
|
54
|
+
"src/**/*.vue",
|
|
55
|
+
"src/**/*.json",
|
|
56
|
+
"src/**/*.d.ts",
|
|
57
|
+
"types/**/*.d.ts",
|
|
58
|
+
"env.d.ts",
|
|
59
|
+
"components.d.ts",
|
|
60
|
+
"typed-components.d.ts"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"tsBuildInfoFile": "./node_modules/.tmp/tsconfig.node.tsbuildinfo",
|
|
4
|
+
"target": "ES2023",
|
|
5
|
+
"lib": [
|
|
6
|
+
"ES2023"
|
|
7
|
+
],
|
|
8
|
+
"moduleDetection": "force",
|
|
9
|
+
"module": "ESNext",
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"resolveJsonModule": true,
|
|
12
|
+
"types": [
|
|
13
|
+
"node"
|
|
14
|
+
],
|
|
15
|
+
"allowImportingTsExtensions": true,
|
|
16
|
+
"strict": true,
|
|
17
|
+
"noFallthroughCasesInSwitch": true,
|
|
18
|
+
"noUnusedLocals": true,
|
|
19
|
+
"noUnusedParameters": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"verbatimModuleSyntax": true,
|
|
22
|
+
"noUncheckedSideEffectImports": true,
|
|
23
|
+
"erasableSyntaxOnly": true,
|
|
24
|
+
"skipLibCheck": true
|
|
25
|
+
},
|
|
26
|
+
"include": [
|
|
27
|
+
"vite.config.ts",
|
|
28
|
+
"vite.config.*.ts",
|
|
29
|
+
"*.config.ts",
|
|
30
|
+
"config/**/*.ts",
|
|
31
|
+
"scripts/**/*.ts"
|
|
32
|
+
]
|
|
33
|
+
}
|