create-weapp-vite 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/dist/chunk-CI2UMYKK.js +277 -0
- package/dist/cli.cjs +280 -11
- package/dist/cli.js +12 -9
- package/dist/index.cjs +317 -0
- package/dist/index.d.cts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +8 -0
- package/package.json +6 -3
- package/templates/default/.editorconfig +9 -0
- package/templates/default/.vscode/settings.json +5 -0
- package/templates/default/README.md +28 -0
- package/templates/default/auto-import-components.json +3 -0
- package/templates/default/gitignore +35 -0
- package/templates/default/package.json +31 -0
- package/templates/default/project.config.json +42 -0
- package/templates/default/project.private.config.json +8 -0
- package/templates/default/public/logo.png +0 -0
- package/templates/default/src/app.json +10 -0
- package/templates/default/src/app.scss +0 -0
- package/templates/default/src/app.ts +6 -0
- package/templates/default/src/components/HelloWorld/HelloWorld.json +6 -0
- package/templates/default/src/components/HelloWorld/HelloWorld.scss +47 -0
- package/templates/default/src/components/HelloWorld/HelloWorld.ts +61 -0
- package/templates/default/src/components/HelloWorld/HelloWorld.wxml +16 -0
- package/templates/default/src/pages/index/index.json +7 -0
- package/templates/default/src/pages/index/index.scss +0 -0
- package/templates/default/src/pages/index/index.ts +24 -0
- package/templates/default/src/pages/index/index.wxml +14 -0
- package/templates/default/src/sitemap.json +10 -0
- package/templates/default/src/theme.json +5 -0
- package/templates/default/src/utils/util.ts +3 -0
- package/templates/default/src/vite-env.d.ts +1 -0
- package/templates/default/tsconfig.app.json +57 -0
- package/templates/default/tsconfig.json +11 -0
- package/templates/default/tsconfig.node.json +33 -0
- package/templates/default/vite.config.ts +39 -0
- package/templates/tailwindcss/.editorconfig +9 -0
- package/templates/tailwindcss/.vscode/settings.json +5 -0
- package/templates/tailwindcss/README.md +28 -0
- package/templates/tailwindcss/auto-import-components.json +3 -0
- package/templates/tailwindcss/gitignore +35 -0
- package/templates/tailwindcss/package.json +38 -0
- package/templates/tailwindcss/postcss.config.js +6 -0
- package/templates/tailwindcss/project.config.json +43 -0
- package/templates/tailwindcss/project.private.config.json +8 -0
- package/templates/tailwindcss/public/icon0.png +0 -0
- package/templates/tailwindcss/public/icon0s.png +0 -0
- package/templates/tailwindcss/public/icon1.png +0 -0
- package/templates/tailwindcss/public/icon1s.png +0 -0
- package/templates/tailwindcss/public/logo.png +0 -0
- package/templates/tailwindcss/src/app.json +31 -0
- package/templates/tailwindcss/src/app.scss +3 -0
- package/templates/tailwindcss/src/app.ts +6 -0
- package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.json +7 -0
- package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.scss +1 -0
- package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.ts +61 -0
- package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.wxml +16 -0
- package/templates/tailwindcss/src/pages/index/index.json +7 -0
- package/templates/tailwindcss/src/pages/index/index.scss +0 -0
- package/templates/tailwindcss/src/pages/index/index.ts +48 -0
- package/templates/tailwindcss/src/pages/index/index.wxml +24 -0
- package/templates/tailwindcss/src/pages/profile/index.json +7 -0
- package/templates/tailwindcss/src/pages/profile/index.scss +0 -0
- package/templates/tailwindcss/src/pages/profile/index.ts +19 -0
- package/templates/tailwindcss/src/pages/profile/index.wxml +11 -0
- package/templates/tailwindcss/src/sitemap.json +10 -0
- package/templates/tailwindcss/src/theme.json +5 -0
- package/templates/tailwindcss/src/utils/util.ts +3 -0
- package/templates/tailwindcss/src/vite-env.d.ts +1 -0
- package/templates/tailwindcss/tailwind.config.ts +22 -0
- package/templates/tailwindcss/tsconfig.app.json +57 -0
- package/templates/tailwindcss/tsconfig.json +11 -0
- package/templates/tailwindcss/tsconfig.node.json +33 -0
- package/templates/tailwindcss/vite.config.ts +37 -0
- package/templates/tdesign/.editorconfig +9 -0
- package/templates/tdesign/.vscode/settings.json +5 -0
- package/templates/tdesign/README.md +28 -0
- package/templates/tdesign/gitignore +35 -0
- package/templates/tdesign/package.json +41 -0
- package/templates/tdesign/postcss.config.js +6 -0
- package/templates/tdesign/project.config.json +45 -0
- package/templates/tdesign/project.private.config.json +8 -0
- package/templates/tdesign/public/logo.png +0 -0
- package/templates/tdesign/src/app.json +10 -0
- package/templates/tdesign/src/app.scss +3 -0
- package/templates/tdesign/src/app.ts +6 -0
- package/templates/tdesign/src/components/HelloWorld/HelloWorld.json +8 -0
- package/templates/tdesign/src/components/HelloWorld/HelloWorld.scss +1 -0
- package/templates/tdesign/src/components/HelloWorld/HelloWorld.ts +64 -0
- package/templates/tdesign/src/components/HelloWorld/HelloWorld.wxml +17 -0
- package/templates/tdesign/src/pages/index/index.json +7 -0
- package/templates/tdesign/src/pages/index/index.scss +0 -0
- package/templates/tdesign/src/pages/index/index.ts +97 -0
- package/templates/tdesign/src/pages/index/index.wxml +24 -0
- package/templates/tdesign/src/sitemap.json +10 -0
- package/templates/tdesign/src/theme.json +5 -0
- package/templates/tdesign/src/utils/util.ts +3 -0
- package/templates/tdesign/src/vite-env.d.ts +1 -0
- package/templates/tdesign/tailwind.config.ts +22 -0
- package/templates/tdesign/tsconfig.app.json +60 -0
- package/templates/tdesign/tsconfig.json +11 -0
- package/templates/tdesign/tsconfig.node.json +33 -0
- package/templates/tdesign/vite.config.ts +41 -0
- package/templates/vant/.editorconfig +9 -0
- package/templates/vant/.vscode/settings.json +5 -0
- package/templates/vant/README.md +28 -0
- package/templates/vant/gitignore +35 -0
- package/templates/vant/package.json +41 -0
- package/templates/vant/postcss.config.js +6 -0
- package/templates/vant/project.config.json +42 -0
- package/templates/vant/project.private.config.json +8 -0
- package/templates/vant/public/logo.png +0 -0
- package/templates/vant/src/app.json +10 -0
- package/templates/vant/src/app.scss +3 -0
- package/templates/vant/src/app.ts +6 -0
- package/templates/vant/src/components/HelloWorld/HelloWorld.json +9 -0
- package/templates/vant/src/components/HelloWorld/HelloWorld.scss +1 -0
- package/templates/vant/src/components/HelloWorld/HelloWorld.ts +61 -0
- package/templates/vant/src/components/HelloWorld/HelloWorld.wxml +19 -0
- package/templates/vant/src/pages/index/index.json +7 -0
- package/templates/vant/src/pages/index/index.scss +0 -0
- package/templates/vant/src/pages/index/index.ts +57 -0
- package/templates/vant/src/pages/index/index.wxml +28 -0
- package/templates/vant/src/sitemap.json +10 -0
- package/templates/vant/src/theme.json +5 -0
- package/templates/vant/src/utils/util.ts +3 -0
- package/templates/vant/src/vite-env.d.ts +1 -0
- package/templates/vant/tailwind.config.ts +22 -0
- package/templates/vant/tsconfig.app.json +60 -0
- package/templates/vant/tsconfig.json +11 -0
- package/templates/vant/tsconfig.node.json +33 -0
- package/templates/vant/vite.config.ts +41 -0
- package/templates/wevu/.editorconfig +9 -0
- package/templates/wevu/.vscode/settings.json +5 -0
- package/templates/wevu/README.md +29 -0
- package/templates/wevu/auto-import-components.json +1 -0
- package/templates/wevu/gitignore +35 -0
- package/templates/wevu/package.json +30 -0
- package/templates/wevu/project.config.json +43 -0
- package/templates/wevu/project.private.config.json +8 -0
- package/templates/wevu/public/logo.png +0 -0
- package/templates/wevu/src/app.vue +36 -0
- package/templates/wevu/src/components/HelloWorld/index.vue +45 -0
- package/templates/wevu/src/pages/index/index.vue +138 -0
- package/templates/wevu/src/sitemap.json +10 -0
- package/templates/wevu/src/theme.json +5 -0
- package/templates/wevu/src/vite-env.d.ts +1 -0
- package/templates/wevu/tsconfig.app.json +57 -0
- package/templates/wevu/tsconfig.json +11 -0
- package/templates/wevu/tsconfig.node.json +33 -0
- package/templates/wevu/vite.config.ts +8 -0
- 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 +161 -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
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import Dialog from '@vant/weapp/dialog/dialog'
|
|
2
|
+
import { hello } from '@/utils/util'
|
|
3
|
+
|
|
4
|
+
Page({
|
|
5
|
+
data: {
|
|
6
|
+
mode: 'light',
|
|
7
|
+
hello: {
|
|
8
|
+
title: 'Hello weapp-vite + Vant',
|
|
9
|
+
description: '基于 weapp-vite 与 Tailwind CSS,并预先集成了 Vant Weapp 组件库,助你快速搭建业务界面。',
|
|
10
|
+
docs: 'https://vite.icebreaker.top',
|
|
11
|
+
links: [
|
|
12
|
+
{
|
|
13
|
+
text: '复制文档链接',
|
|
14
|
+
url: 'https://vite.icebreaker.top',
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
text: 'Vant 组件手册',
|
|
18
|
+
url: 'https://vant-contrib.gitee.io/vant-weapp/#/home',
|
|
19
|
+
variant: 'ghost',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
switchMode() {
|
|
25
|
+
if (this.data.mode === 'light') {
|
|
26
|
+
this.setData({
|
|
27
|
+
mode: 'dark',
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
this.setData({
|
|
32
|
+
mode: 'light',
|
|
33
|
+
})
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
async copy(e: WechatMiniprogram.BaseEvent) {
|
|
37
|
+
if (e.mark?.url) {
|
|
38
|
+
await wx.setClipboardData({
|
|
39
|
+
data: e.mark.url,
|
|
40
|
+
})
|
|
41
|
+
// eslint-disable-next-line no-console
|
|
42
|
+
console.log(`复制成功: ${e.mark.url}`)
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
showDialog() {
|
|
46
|
+
Dialog.alert({
|
|
47
|
+
title: '我来自Vant',
|
|
48
|
+
message: '我是Dialog',
|
|
49
|
+
}).then(() => {
|
|
50
|
+
// on close
|
|
51
|
+
})
|
|
52
|
+
},
|
|
53
|
+
onLoad() {
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
console.log(hello())
|
|
56
|
+
},
|
|
57
|
+
})
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<view class="min-h-screen {{ mode === 'light'?'bg-gray-100 text-slate-800':'bg-gray-900 text-slate-200' }} transition-colors duration-500">
|
|
2
|
+
<view class="flex flex-col items-center pt-20 space-y-10">
|
|
3
|
+
<view class="flex space-x-8">
|
|
4
|
+
<view class="w-24 h-24 bg-[url(https://vite.icebreaker.top/logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
|
|
5
|
+
<view class="w-32 h-24 bg-[url(https://vite.icebreaker.top/tw-logo.png)] bg-[length:100%_100%] bg-no-repeat"></view>
|
|
6
|
+
</view>
|
|
7
|
+
<view class="bg-gradient-to-r from-green-400 to-sky-400 bg-clip-text text-xl font-extrabold text-transparent underline">
|
|
8
|
+
weapp-vite & weapp-tailwindcss
|
|
9
|
+
</view>
|
|
10
|
+
<HelloWorld
|
|
11
|
+
title="{{hello.title}}"
|
|
12
|
+
description="{{hello.description}}"
|
|
13
|
+
docs="{{hello.docs}}"
|
|
14
|
+
links="{{hello.links}}"
|
|
15
|
+
/>
|
|
16
|
+
<view class="{{ mode === 'light' ? 'i-mdi-moon-waxing-crescent':'i-mdi-weather-sunny text-white' }} text-8xl" bind:tap="switchMode"></view>
|
|
17
|
+
<view class="underline" mark:url="https://vite.icebreaker.top" bind:tap="copy">
|
|
18
|
+
https://vite.icebreaker.top
|
|
19
|
+
</view>
|
|
20
|
+
<view class="underline" mark:url="https://tw.icebreaker.top" bind:tap="copy">
|
|
21
|
+
https://tw.icebreaker.top
|
|
22
|
+
</view>
|
|
23
|
+
<view>
|
|
24
|
+
<van-button type="default" @tap="showDialog">Vant 按钮</van-button>
|
|
25
|
+
</view>
|
|
26
|
+
</view>
|
|
27
|
+
</view>
|
|
28
|
+
<van-dialog id="van-dialog" />
|
|
@@ -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}',
|
|
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,60 @@
|
|
|
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
|
+
"@vant/weapp/*": [
|
|
20
|
+
"./node_modules/@vant/weapp/dist/*"
|
|
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
|
+
]
|
|
60
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { UnifiedViteWeappTailwindcssPlugin } from 'weapp-tailwindcss/vite'
|
|
2
|
+
import { VantResolver } from 'weapp-vite/auto-import-components/resolvers'
|
|
3
|
+
import { defineConfig } from 'weapp-vite/config'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
weapp: {
|
|
7
|
+
srcRoot: 'src',
|
|
8
|
+
autoImportComponents: {
|
|
9
|
+
resolvers: [VantResolver()],
|
|
10
|
+
},
|
|
11
|
+
// pnpm g 生成的格式
|
|
12
|
+
// https://vite.icebreaker.top/guide/generate.html
|
|
13
|
+
generate: {
|
|
14
|
+
extensions: {
|
|
15
|
+
js: 'ts',
|
|
16
|
+
wxss: 'scss',
|
|
17
|
+
},
|
|
18
|
+
dirs: {
|
|
19
|
+
component: 'src/components',
|
|
20
|
+
page: 'src/pages',
|
|
21
|
+
},
|
|
22
|
+
// 假如你想让默认生成的组件命名为 HelloWorld/index 而不是 HelloWorld/HelloWorld 可以下列选项
|
|
23
|
+
// filenames: {
|
|
24
|
+
// component: 'index',
|
|
25
|
+
// page: 'index',
|
|
26
|
+
// },
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
css: {
|
|
30
|
+
preprocessorOptions: {
|
|
31
|
+
scss: {
|
|
32
|
+
silenceDeprecations: ['legacy-js-api', 'import'],
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
plugins: [
|
|
37
|
+
UnifiedViteWeappTailwindcssPlugin({
|
|
38
|
+
rem2rpx: true,
|
|
39
|
+
}),
|
|
40
|
+
],
|
|
41
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# weapp-vite-wevu-template
|
|
2
|
+
|
|
3
|
+
`weapp-vite` + `wevu`(Vue SFC)模板
|
|
4
|
+
|
|
5
|
+
## 使用方式
|
|
6
|
+
|
|
7
|
+
### 开发
|
|
8
|
+
|
|
9
|
+
- `pnpm dev`
|
|
10
|
+
|
|
11
|
+
- `pnpm dev --open` 可以打包并直接启动微信开发者工具
|
|
12
|
+
|
|
13
|
+
### 推荐写法
|
|
14
|
+
|
|
15
|
+
- 页面/组件优先使用 Vue `<script setup>`(编译宏)写法
|
|
16
|
+
- 配置使用 `<json>` 自定义块
|
|
17
|
+
|
|
18
|
+
### 构建
|
|
19
|
+
|
|
20
|
+
`pnpm build`
|
|
21
|
+
|
|
22
|
+
### 打开微信开发者工具
|
|
23
|
+
|
|
24
|
+
`pnpm open`
|
|
25
|
+
|
|
26
|
+
## 文档地址
|
|
27
|
+
|
|
28
|
+
0. `weapp-vite`: https://vite.icebreaker.top/
|
|
29
|
+
1. `wevu`: https://vite.icebreaker.top/wevu/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# dependencies
|
|
2
|
+
node_modules
|
|
3
|
+
.pnp
|
|
4
|
+
.pnp.js
|
|
5
|
+
|
|
6
|
+
# testing
|
|
7
|
+
coverage
|
|
8
|
+
|
|
9
|
+
# next.js
|
|
10
|
+
.next/
|
|
11
|
+
out/
|
|
12
|
+
build
|
|
13
|
+
|
|
14
|
+
# misc
|
|
15
|
+
.DS_Store
|
|
16
|
+
*.pem
|
|
17
|
+
|
|
18
|
+
# debug
|
|
19
|
+
npm-debug.log*
|
|
20
|
+
yarn-debug.log*
|
|
21
|
+
yarn-error.log*
|
|
22
|
+
.pnpm-debug.log*
|
|
23
|
+
|
|
24
|
+
# local env files
|
|
25
|
+
.env.local
|
|
26
|
+
.env.development.local
|
|
27
|
+
.env.test.local
|
|
28
|
+
.env.production.local
|
|
29
|
+
|
|
30
|
+
# turbo
|
|
31
|
+
.turbo
|
|
32
|
+
|
|
33
|
+
dist
|
|
34
|
+
vite.config.ts.timestamp-*.mjs
|
|
35
|
+
dist-web
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "weapp-vite-wevu-template",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "1.0.0",
|
|
5
|
+
"private": true,
|
|
6
|
+
"description": "weapp-vite + wevu (Vue SFC) 模板",
|
|
7
|
+
"author": "ice breaker <1324318532@qq.com>",
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/weapp-vite/weapp-vite.git",
|
|
12
|
+
"directory": "templates/weapp-vite-wevu-template"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/weapp-vite/weapp-vite/issues"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [],
|
|
18
|
+
"scripts": {
|
|
19
|
+
"dev": "weapp-vite dev",
|
|
20
|
+
"dev:open": "weapp-vite dev -o",
|
|
21
|
+
"build": "weapp-vite build",
|
|
22
|
+
"open": "weapp-vite open"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"miniprogram-api-typings": "^4.1.2",
|
|
26
|
+
"typescript": "^5.9.3",
|
|
27
|
+
"weapp-vite": "workspace:*",
|
|
28
|
+
"wevu": "workspace:*"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "项目配置文件",
|
|
3
|
+
"miniprogramRoot": "dist/",
|
|
4
|
+
"compileType": "miniprogram",
|
|
5
|
+
"setting": {
|
|
6
|
+
"babelSetting": {
|
|
7
|
+
"ignore": [],
|
|
8
|
+
"disablePlugins": [],
|
|
9
|
+
"outputPath": ""
|
|
10
|
+
},
|
|
11
|
+
"coverView": false,
|
|
12
|
+
"postcss": false,
|
|
13
|
+
"minified": false,
|
|
14
|
+
"enhance": false,
|
|
15
|
+
"showShadowRootInWxmlPanel": false,
|
|
16
|
+
"packNpmRelationList": [
|
|
17
|
+
{
|
|
18
|
+
"packageJsonPath": "./package.json",
|
|
19
|
+
"miniprogramNpmDistDir": "./dist"
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
"ignoreUploadUnusedFiles": true,
|
|
23
|
+
"compileHotReLoad": false,
|
|
24
|
+
"skylineRenderEnable": true,
|
|
25
|
+
"packNpmManually": true,
|
|
26
|
+
"es6": true,
|
|
27
|
+
"minifyWXML": true
|
|
28
|
+
},
|
|
29
|
+
"simulatorType": "wechat",
|
|
30
|
+
"simulatorPluginLibVersion": {},
|
|
31
|
+
"condition": {},
|
|
32
|
+
"srcMiniprogramRoot": "dist/",
|
|
33
|
+
"editorSetting": {
|
|
34
|
+
"tabIndent": "insertSpaces",
|
|
35
|
+
"tabSize": 2
|
|
36
|
+
},
|
|
37
|
+
"libVersion": "2.32.3",
|
|
38
|
+
"packOptions": {
|
|
39
|
+
"ignore": [],
|
|
40
|
+
"include": []
|
|
41
|
+
},
|
|
42
|
+
"appid": "wx6ffee4673b257014"
|
|
43
|
+
}
|
|
@@ -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,36 @@
|
|
|
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
|
+
page {
|
|
33
|
+
color: #1c1c3c;
|
|
34
|
+
background: #f6f7fb;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
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="header">
|
|
16
|
+
<text class="title">
|
|
17
|
+
{{ props.title }}
|
|
18
|
+
</text>
|
|
19
|
+
<text v-if="props.subtitle" class="subtitle">
|
|
20
|
+
{{ props.subtitle }}
|
|
21
|
+
</text>
|
|
22
|
+
</view>
|
|
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>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, ref, watch } from 'wevu'
|
|
3
|
+
|
|
4
|
+
import HelloWorld from '@/components/HelloWorld/index.vue'
|
|
5
|
+
|
|
6
|
+
definePageJson({
|
|
7
|
+
navigationBarTitleText: '首页',
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const count = ref(0)
|
|
11
|
+
const message = ref('Hello WeVU!')
|
|
12
|
+
const todos = ref([
|
|
13
|
+
'用 Vue SFC 写页面/组件',
|
|
14
|
+
'用 wevu API(ref/computed/watch)写逻辑',
|
|
15
|
+
'用 v-for / v-if / @tap / v-model 写模板',
|
|
16
|
+
])
|
|
17
|
+
|
|
18
|
+
const doubled = computed(() => count.value * 2)
|
|
19
|
+
|
|
20
|
+
function increment() {
|
|
21
|
+
count.value += 1
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function reset() {
|
|
25
|
+
count.value = 0
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
watch(count, (newValue, oldValue) => {
|
|
29
|
+
console.log(`[wevu] count changed: ${oldValue} -> ${newValue}`)
|
|
30
|
+
})
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<view class="page">
|
|
35
|
+
<HelloWorld :title="message" :subtitle="`count=${count}, doubled=${doubled}`" />
|
|
36
|
+
|
|
37
|
+
<view class="card">
|
|
38
|
+
<view class="row">
|
|
39
|
+
<text class="label">
|
|
40
|
+
当前计数:{{ count }}
|
|
41
|
+
</text>
|
|
42
|
+
<text class="label">
|
|
43
|
+
双倍:{{ doubled }}
|
|
44
|
+
</text>
|
|
45
|
+
</view>
|
|
46
|
+
|
|
47
|
+
<view class="row actions">
|
|
48
|
+
<button class="btn primary" @tap="increment">
|
|
49
|
+
+1
|
|
50
|
+
</button>
|
|
51
|
+
<button class="btn danger" @tap="reset">
|
|
52
|
+
重置
|
|
53
|
+
</button>
|
|
54
|
+
</view>
|
|
55
|
+
|
|
56
|
+
<view class="row">
|
|
57
|
+
<text class="label">
|
|
58
|
+
文本双向绑定:
|
|
59
|
+
</text>
|
|
60
|
+
</view>
|
|
61
|
+
<input v-model="message" class="input" placeholder="输入标题…">
|
|
62
|
+
|
|
63
|
+
<view class="row">
|
|
64
|
+
<text class="label">
|
|
65
|
+
Checklist
|
|
66
|
+
</text>
|
|
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>
|
|
72
|
+
</view>
|
|
73
|
+
</view>
|
|
74
|
+
</view>
|
|
75
|
+
</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>
|