create-weapp-vite 1.2.1 → 1.3.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.
Files changed (174) hide show
  1. package/dist/chunk-REHXOFVU.js +277 -0
  2. package/dist/cli.cjs +280 -11
  3. package/dist/cli.js +12 -9
  4. package/dist/index.cjs +317 -0
  5. package/dist/index.d.cts +11 -1
  6. package/dist/index.d.ts +11 -1
  7. package/dist/index.js +8 -0
  8. package/package.json +6 -3
  9. package/templates/default/.editorconfig +9 -0
  10. package/templates/default/.vscode/settings.json +5 -0
  11. package/templates/default/README.md +28 -0
  12. package/templates/default/auto-import-components.json +3 -0
  13. package/templates/default/gitignore +35 -0
  14. package/templates/default/package.json +31 -0
  15. package/templates/default/project.config.json +42 -0
  16. package/templates/default/project.private.config.json +8 -0
  17. package/templates/default/public/logo.png +0 -0
  18. package/templates/default/src/app.json +10 -0
  19. package/templates/default/src/app.scss +0 -0
  20. package/templates/default/src/app.ts +6 -0
  21. package/templates/default/src/components/HelloWorld/HelloWorld.json +6 -0
  22. package/templates/default/src/components/HelloWorld/HelloWorld.scss +47 -0
  23. package/templates/default/src/components/HelloWorld/HelloWorld.ts +61 -0
  24. package/templates/default/src/components/HelloWorld/HelloWorld.wxml +16 -0
  25. package/templates/default/src/pages/index/index.json +7 -0
  26. package/templates/default/src/pages/index/index.scss +0 -0
  27. package/templates/default/src/pages/index/index.ts +24 -0
  28. package/templates/default/src/pages/index/index.wxml +14 -0
  29. package/templates/default/src/sitemap.json +10 -0
  30. package/templates/default/src/theme.json +5 -0
  31. package/templates/default/src/utils/util.ts +3 -0
  32. package/templates/default/src/vite-env.d.ts +1 -0
  33. package/templates/default/tsconfig.app.json +57 -0
  34. package/templates/default/tsconfig.json +11 -0
  35. package/templates/default/tsconfig.node.json +33 -0
  36. package/templates/default/vite.config.ts +39 -0
  37. package/templates/tailwindcss/.editorconfig +9 -0
  38. package/templates/tailwindcss/.vscode/settings.json +5 -0
  39. package/templates/tailwindcss/README.md +28 -0
  40. package/templates/tailwindcss/auto-import-components.json +3 -0
  41. package/templates/tailwindcss/gitignore +35 -0
  42. package/templates/tailwindcss/package.json +38 -0
  43. package/templates/tailwindcss/postcss.config.js +6 -0
  44. package/templates/tailwindcss/project.config.json +43 -0
  45. package/templates/tailwindcss/project.private.config.json +8 -0
  46. package/templates/tailwindcss/public/icon0.png +0 -0
  47. package/templates/tailwindcss/public/icon0s.png +0 -0
  48. package/templates/tailwindcss/public/icon1.png +0 -0
  49. package/templates/tailwindcss/public/icon1s.png +0 -0
  50. package/templates/tailwindcss/public/logo.png +0 -0
  51. package/templates/tailwindcss/src/app.json +31 -0
  52. package/templates/tailwindcss/src/app.scss +3 -0
  53. package/templates/tailwindcss/src/app.ts +6 -0
  54. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.json +7 -0
  55. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.scss +1 -0
  56. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.ts +61 -0
  57. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.wxml +16 -0
  58. package/templates/tailwindcss/src/pages/index/index.json +7 -0
  59. package/templates/tailwindcss/src/pages/index/index.scss +0 -0
  60. package/templates/tailwindcss/src/pages/index/index.ts +48 -0
  61. package/templates/tailwindcss/src/pages/index/index.wxml +24 -0
  62. package/templates/tailwindcss/src/pages/profile/index.json +7 -0
  63. package/templates/tailwindcss/src/pages/profile/index.scss +0 -0
  64. package/templates/tailwindcss/src/pages/profile/index.ts +19 -0
  65. package/templates/tailwindcss/src/pages/profile/index.wxml +11 -0
  66. package/templates/tailwindcss/src/sitemap.json +10 -0
  67. package/templates/tailwindcss/src/theme.json +5 -0
  68. package/templates/tailwindcss/src/utils/util.ts +3 -0
  69. package/templates/tailwindcss/src/vite-env.d.ts +1 -0
  70. package/templates/tailwindcss/tailwind.config.ts +22 -0
  71. package/templates/tailwindcss/tsconfig.app.json +57 -0
  72. package/templates/tailwindcss/tsconfig.json +11 -0
  73. package/templates/tailwindcss/tsconfig.node.json +33 -0
  74. package/templates/tailwindcss/vite.config.ts +37 -0
  75. package/templates/tdesign/.editorconfig +9 -0
  76. package/templates/tdesign/.vscode/settings.json +5 -0
  77. package/templates/tdesign/README.md +28 -0
  78. package/templates/tdesign/gitignore +35 -0
  79. package/templates/tdesign/package.json +41 -0
  80. package/templates/tdesign/postcss.config.js +6 -0
  81. package/templates/tdesign/project.config.json +45 -0
  82. package/templates/tdesign/project.private.config.json +8 -0
  83. package/templates/tdesign/public/logo.png +0 -0
  84. package/templates/tdesign/src/app.json +10 -0
  85. package/templates/tdesign/src/app.scss +3 -0
  86. package/templates/tdesign/src/app.ts +6 -0
  87. package/templates/tdesign/src/components/HelloWorld/HelloWorld.json +8 -0
  88. package/templates/tdesign/src/components/HelloWorld/HelloWorld.scss +1 -0
  89. package/templates/tdesign/src/components/HelloWorld/HelloWorld.ts +64 -0
  90. package/templates/tdesign/src/components/HelloWorld/HelloWorld.wxml +17 -0
  91. package/templates/tdesign/src/pages/index/index.json +7 -0
  92. package/templates/tdesign/src/pages/index/index.scss +0 -0
  93. package/templates/tdesign/src/pages/index/index.ts +97 -0
  94. package/templates/tdesign/src/pages/index/index.wxml +24 -0
  95. package/templates/tdesign/src/sitemap.json +10 -0
  96. package/templates/tdesign/src/theme.json +5 -0
  97. package/templates/tdesign/src/utils/util.ts +3 -0
  98. package/templates/tdesign/src/vite-env.d.ts +1 -0
  99. package/templates/tdesign/tailwind.config.ts +22 -0
  100. package/templates/tdesign/tsconfig.app.json +60 -0
  101. package/templates/tdesign/tsconfig.json +11 -0
  102. package/templates/tdesign/tsconfig.node.json +33 -0
  103. package/templates/tdesign/vite.config.ts +41 -0
  104. package/templates/vant/.editorconfig +9 -0
  105. package/templates/vant/.vscode/settings.json +5 -0
  106. package/templates/vant/README.md +28 -0
  107. package/templates/vant/gitignore +35 -0
  108. package/templates/vant/package.json +41 -0
  109. package/templates/vant/postcss.config.js +6 -0
  110. package/templates/vant/project.config.json +42 -0
  111. package/templates/vant/project.private.config.json +8 -0
  112. package/templates/vant/public/logo.png +0 -0
  113. package/templates/vant/src/app.json +10 -0
  114. package/templates/vant/src/app.scss +3 -0
  115. package/templates/vant/src/app.ts +6 -0
  116. package/templates/vant/src/components/HelloWorld/HelloWorld.json +9 -0
  117. package/templates/vant/src/components/HelloWorld/HelloWorld.scss +1 -0
  118. package/templates/vant/src/components/HelloWorld/HelloWorld.ts +61 -0
  119. package/templates/vant/src/components/HelloWorld/HelloWorld.wxml +19 -0
  120. package/templates/vant/src/pages/index/index.json +7 -0
  121. package/templates/vant/src/pages/index/index.scss +0 -0
  122. package/templates/vant/src/pages/index/index.ts +57 -0
  123. package/templates/vant/src/pages/index/index.wxml +28 -0
  124. package/templates/vant/src/sitemap.json +10 -0
  125. package/templates/vant/src/theme.json +5 -0
  126. package/templates/vant/src/utils/util.ts +3 -0
  127. package/templates/vant/src/vite-env.d.ts +1 -0
  128. package/templates/vant/tailwind.config.ts +22 -0
  129. package/templates/vant/tsconfig.app.json +60 -0
  130. package/templates/vant/tsconfig.json +11 -0
  131. package/templates/vant/tsconfig.node.json +33 -0
  132. package/templates/vant/vite.config.ts +41 -0
  133. package/templates/wevu/.editorconfig +9 -0
  134. package/templates/wevu/.vscode/settings.json +5 -0
  135. package/templates/wevu/README.md +29 -0
  136. package/templates/wevu/auto-import-components.json +1 -0
  137. package/templates/wevu/gitignore +35 -0
  138. package/templates/wevu/package.json +30 -0
  139. package/templates/wevu/project.config.json +43 -0
  140. package/templates/wevu/project.private.config.json +8 -0
  141. package/templates/wevu/public/logo.png +0 -0
  142. package/templates/wevu/src/app.vue +36 -0
  143. package/templates/wevu/src/components/HelloWorld/index.vue +45 -0
  144. package/templates/wevu/src/pages/index/index.vue +138 -0
  145. package/templates/wevu/src/sitemap.json +10 -0
  146. package/templates/wevu/src/theme.json +5 -0
  147. package/templates/wevu/src/vite-env.d.ts +1 -0
  148. package/templates/wevu/tsconfig.app.json +57 -0
  149. package/templates/wevu/tsconfig.json +11 -0
  150. package/templates/wevu/tsconfig.node.json +33 -0
  151. package/templates/wevu/vite.config.ts +8 -0
  152. package/templates/wevu-tdesign/.editorconfig +9 -0
  153. package/templates/wevu-tdesign/.vscode/settings.json +5 -0
  154. package/templates/wevu-tdesign/README.md +29 -0
  155. package/templates/wevu-tdesign/auto-import-components.json +83 -0
  156. package/templates/wevu-tdesign/components.d.ts +183 -0
  157. package/templates/wevu-tdesign/gitignore +35 -0
  158. package/templates/wevu-tdesign/package.json +41 -0
  159. package/templates/wevu-tdesign/postcss.config.js +6 -0
  160. package/templates/wevu-tdesign/project.config.json +43 -0
  161. package/templates/wevu-tdesign/project.private.config.json +8 -0
  162. package/templates/wevu-tdesign/public/logo.png +0 -0
  163. package/templates/wevu-tdesign/src/app.vue +35 -0
  164. package/templates/wevu-tdesign/src/components/HelloWorld/index.vue +23 -0
  165. package/templates/wevu-tdesign/src/pages/index/index.vue +161 -0
  166. package/templates/wevu-tdesign/src/sitemap.json +10 -0
  167. package/templates/wevu-tdesign/src/theme.json +5 -0
  168. package/templates/wevu-tdesign/src/vite-env.d.ts +1 -0
  169. package/templates/wevu-tdesign/tailwind.config.ts +22 -0
  170. package/templates/wevu-tdesign/tsconfig.app.json +62 -0
  171. package/templates/wevu-tdesign/tsconfig.json +11 -0
  172. package/templates/wevu-tdesign/tsconfig.node.json +33 -0
  173. package/templates/wevu-tdesign/typed-components.d.ts +943 -0
  174. package/templates/wevu-tdesign/vite.config.ts +43 -0
@@ -0,0 +1,61 @@
1
+ interface HelloWorldLink {
2
+ text: string
3
+ url: string
4
+ variant?: 'ghost'
5
+ }
6
+
7
+ Component({
8
+ properties: {
9
+ title: {
10
+ type: String,
11
+ value: 'Hello weapp-vite',
12
+ },
13
+ description: {
14
+ type: String,
15
+ value: '欢迎使用 weapp-vite 模板。',
16
+ },
17
+ docs: {
18
+ type: String,
19
+ value: '',
20
+ },
21
+ links: {
22
+ type: Array,
23
+ value: [] as HelloWorldLink[],
24
+ },
25
+ },
26
+ lifetimes: {
27
+ attached() {
28
+ if (!this.data.links?.length && this.data.docs) {
29
+ this.setData({
30
+ links: [
31
+ {
32
+ text: '复制文档链接',
33
+ url: this.data.docs,
34
+ },
35
+ ],
36
+ })
37
+ }
38
+ },
39
+ },
40
+ methods: {
41
+ async copyLink(event: WechatMiniprogram.TouchEvent) {
42
+ const url = event.currentTarget.dataset?.url as string | undefined
43
+ if (!url) {
44
+ return
45
+ }
46
+
47
+ try {
48
+ await wx.setClipboardData({ data: url })
49
+ wx.showToast({
50
+ title: '链接已复制',
51
+ icon: 'success',
52
+ duration: 1500,
53
+ })
54
+ }
55
+ catch (error) {
56
+ // eslint-disable-next-line no-console
57
+ console.error('复制链接失败', error)
58
+ }
59
+ },
60
+ },
61
+ })
@@ -0,0 +1,16 @@
1
+ <view class="hello-card">
2
+ <view class="hello-title">{{title}}</view>
3
+ <view class="hello-body">{{description}}</view>
4
+ <view wx:if="{{links.length}}" class="hello-actions">
5
+ <view
6
+ wx:for="{{links}}"
7
+ wx:key="url"
8
+ class="hello-button {{item.variant === 'ghost' ? 'hello-button--ghost' : ''}}"
9
+ data-url="{{item.url}}"
10
+ bindtap="copyLink"
11
+ >
12
+ {{item.text}}
13
+ </view>
14
+ </view>
15
+ <view wx:if="{{links.length}}" class="hello-tip">复制后即可在浏览器中打开对应链接</view>
16
+ </view>
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "usingComponents": {
4
+ "HelloWorld": "/components/HelloWorld/HelloWorld"
5
+ },
6
+ "navigationBarTitleText": "初始模板"
7
+ }
File without changes
@@ -0,0 +1,24 @@
1
+ Page({
2
+ data: {
3
+ hello: {
4
+ title: 'Hello weapp-vite',
5
+ description: '这是最基础的 weapp-vite 模板,包含快速开发所需的构建与热更新能力。',
6
+ docs: 'https://vite.icebreaker.top',
7
+ links: [
8
+ {
9
+ text: '复制文档链接',
10
+ url: 'https://vite.icebreaker.top',
11
+ },
12
+ {
13
+ text: 'GitHub 仓库',
14
+ url: 'https://github.com/weapp-vite/weapp-vite',
15
+ variant: 'ghost',
16
+ },
17
+ ],
18
+ },
19
+ },
20
+ onClick() {
21
+ // eslint-disable-next-line no-console
22
+ console.log('on click')
23
+ },
24
+ })
@@ -0,0 +1,14 @@
1
+ <view>
2
+ <view style="display:flex;align-items:center;justify-content:center;">
3
+ <view>
4
+ <image style="width:200px;height:190px" src="/logo.png" />
5
+ <view bind:tap="onClick">Hello World From Weapp-vite!</view>
6
+ </view>
7
+ </view>
8
+ <HelloWorld
9
+ title="{{hello.title}}"
10
+ description="{{hello.description}}"
11
+ docs="{{hello.docs}}"
12
+ links="{{hello.links}}"
13
+ />
14
+ </view>
@@ -0,0 +1,10 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/sitemap.json",
3
+ "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
4
+ "rules": [
5
+ {
6
+ "action": "allow",
7
+ "page": "*"
8
+ }
9
+ ]
10
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/theme.json",
3
+ "light": {},
4
+ "dark": {}
5
+ }
@@ -0,0 +1,3 @@
1
+ export function hello() {
2
+ return 'world'
3
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="weapp-vite/client" />
@@ -0,0 +1,57 @@
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
+ },
20
+ "resolveJsonModule": true,
21
+ "types": [
22
+ "miniprogram-api-typings"
23
+ ],
24
+ "allowImportingTsExtensions": true,
25
+ "allowJs": true,
26
+ "strict": true,
27
+ "noFallthroughCasesInSwitch": true,
28
+ "noUnusedLocals": true,
29
+ "noUnusedParameters": true,
30
+ "noEmit": true,
31
+ "allowSyntheticDefaultImports": true,
32
+ "esModuleInterop": true,
33
+ "isolatedModules": true,
34
+ "verbatimModuleSyntax": true,
35
+ "noUncheckedSideEffectImports": true,
36
+ "erasableSyntaxOnly": true,
37
+ "skipLibCheck": true
38
+ },
39
+ "vueCompilerOptions": {
40
+ "plugins": [
41
+ "weapp-vite/volar"
42
+ ]
43
+ },
44
+ "include": [
45
+ "src/**/*.ts",
46
+ "src/**/*.tsx",
47
+ "src/**/*.js",
48
+ "src/**/*.jsx",
49
+ "src/**/*.mts",
50
+ "src/**/*.cts",
51
+ "src/**/*.vue",
52
+ "src/**/*.json",
53
+ "src/**/*.d.ts",
54
+ "types/**/*.d.ts",
55
+ "env.d.ts"
56
+ ]
57
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "references": [
3
+ {
4
+ "path": "./tsconfig.app.json"
5
+ },
6
+ {
7
+ "path": "./tsconfig.node.json"
8
+ }
9
+ ],
10
+ "files": []
11
+ }
@@ -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,39 @@
1
+ import { defineConfig } from 'weapp-vite/config'
2
+
3
+ export default defineConfig(
4
+ ({ mode }) => {
5
+ console.log('[mode]:', mode)
6
+ return {
7
+ weapp: {
8
+ srcRoot: 'src',
9
+ // pnpm g 生成的格式
10
+ // https://vite.icebreaker.top/guide/generate.html
11
+ generate: {
12
+ extensions: {
13
+ js: 'ts',
14
+ wxss: 'scss',
15
+ },
16
+ dirs: {
17
+ component: 'src/components',
18
+ page: 'src/pages',
19
+ },
20
+ // 假如你想让默认生成的组件命名为 HelloWorld/index 而不是 HelloWorld/HelloWorld 可以下列选项
21
+ // filenames: {
22
+ // component: 'index',
23
+ // page: 'index',
24
+ // },
25
+ },
26
+ },
27
+ css: {
28
+ preprocessorOptions: {
29
+ scss: {
30
+ silenceDeprecations: ['legacy-js-api', 'import'],
31
+ },
32
+ },
33
+ },
34
+ plugins: [
35
+ // 在这里注册 vite 插件
36
+ ],
37
+ }
38
+ },
39
+ )
@@ -0,0 +1,9 @@
1
+ root = true
2
+
3
+ [*]
4
+ charset = utf-8
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
@@ -0,0 +1,5 @@
1
+ {
2
+ "tailwindCSS.includeLanguages": {
3
+ "wxml": "html"
4
+ }
5
+ }
@@ -0,0 +1,28 @@
1
+ # weapp-vite-tailwindcss-template
2
+
3
+ `weapp-vite` 集成 `tailwindcss` 的模板
4
+
5
+ ## 使用方式
6
+
7
+ ### 开发
8
+
9
+ - `pnpm dev`
10
+
11
+ - `pnpm dev --open` 可以打包并直接启动微信开发者工具
12
+
13
+ ### 构建
14
+
15
+ `pnpm build`
16
+
17
+ ### 打开微信开发者工具
18
+
19
+ `pnpm open`
20
+
21
+ ### 生成组件/页面
22
+
23
+ `pnpm g path/to/your/component`
24
+
25
+ ## 文档地址
26
+
27
+ 0. `weapp-vite`: https://vite.icebreaker.top/
28
+ 1. `weapp-tailwindcss`: https://tw.icebreaker.top/
@@ -0,0 +1,3 @@
1
+ {
2
+ "HelloWorld": "/components/HelloWorld/HelloWorld"
3
+ }
@@ -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,38 @@
1
+ {
2
+ "name": "weapp-vite-tailwindcss-template",
3
+ "type": "module",
4
+ "version": "1.0.3",
5
+ "private": true,
6
+ "description": "原生微信小程序 weapp-vite + tailwindcss 模板",
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-tailwindcss-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
+ "g": "weapp-vite generate",
24
+ "postinstall": "weapp-tw patch"
25
+ },
26
+ "devDependencies": {
27
+ "@egoist/tailwindcss-icons": "^1.9.0",
28
+ "@iconify-json/mdi": "^1.2.3",
29
+ "autoprefixer": "^10.4.23",
30
+ "miniprogram-api-typings": "^4.1.2",
31
+ "postcss": "^8.5.6",
32
+ "sass": "^1.97.1",
33
+ "tailwindcss": "^3.4.19",
34
+ "typescript": "^5.9.3",
35
+ "weapp-tailwindcss": "^4.9.2",
36
+ "weapp-vite": "workspace:*"
37
+ }
38
+ }
@@ -0,0 +1,6 @@
1
+ export default {
2
+ plugins: {
3
+ tailwindcss: {},
4
+ autoprefixer: {},
5
+ },
6
+ }
@@ -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": true,
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-tailwindcss-template",
4
+ "setting": {
5
+ "compileHotReLoad": true
6
+ },
7
+ "libVersion": "3.9.3"
8
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/app.json",
3
+ "pages": [
4
+ "pages/index/index",
5
+ "pages/profile/index"
6
+ ],
7
+ "window": {},
8
+ "style": "v2",
9
+ "componentFramework": "glass-easel",
10
+ "sitemapLocation": "sitemap.json",
11
+ "lazyCodeLoading": "requiredComponents",
12
+ "tabBar": {
13
+ "color": "#333",
14
+ "backgroundColor": "#fff",
15
+ "selectedColor": "#1AAD19",
16
+ "list": [
17
+ {
18
+ "pagePath": "pages/index/index",
19
+ "text": "首页",
20
+ "iconPath": "icon0.png",
21
+ "selectedIconPath": "icon0s.png"
22
+ },
23
+ {
24
+ "pagePath": "pages/profile/index",
25
+ "text": "我的",
26
+ "iconPath": "icon1.png",
27
+ "selectedIconPath": "icon1s.png"
28
+ }
29
+ ]
30
+ }
31
+ }
@@ -0,0 +1,3 @@
1
+ @use 'tailwindcss/base';
2
+ @use 'tailwindcss/components';
3
+ @use 'tailwindcss/utilities';
@@ -0,0 +1,6 @@
1
+ App({
2
+ globalData: {},
3
+ onLaunch() {
4
+
5
+ },
6
+ })
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/component.json",
3
+ "component": true,
4
+ // 组件需要设置成 "apply-shared" 才能使用 app.wxss 里的全局样式
5
+ "styleIsolation": "apply-shared",
6
+ "usingComponents": {}
7
+ }
@@ -0,0 +1 @@
1
+ /* Tailwind CSS utilities are applied directly in the template. */
@@ -0,0 +1,61 @@
1
+ interface HelloWorldLink {
2
+ text: string
3
+ url: string
4
+ variant?: 'ghost'
5
+ }
6
+
7
+ Component({
8
+ properties: {
9
+ title: {
10
+ type: String,
11
+ value: 'Hello weapp-vite',
12
+ },
13
+ description: {
14
+ type: String,
15
+ value: '欢迎使用 weapp-vite 模板,这里演示了如何在组件内快速放置介绍信息。',
16
+ },
17
+ docs: {
18
+ type: String,
19
+ value: '',
20
+ },
21
+ links: {
22
+ type: Array,
23
+ value: [] as HelloWorldLink[],
24
+ },
25
+ },
26
+ lifetimes: {
27
+ attached() {
28
+ if (!this.data.links?.length && this.data.docs) {
29
+ this.setData({
30
+ links: [
31
+ {
32
+ text: '复制文档链接',
33
+ url: this.data.docs,
34
+ },
35
+ ],
36
+ })
37
+ }
38
+ },
39
+ },
40
+ methods: {
41
+ async copyLink(event: WechatMiniprogram.TouchEvent) {
42
+ const url = event.currentTarget.dataset?.url as string | undefined
43
+ if (!url) {
44
+ return
45
+ }
46
+
47
+ try {
48
+ await wx.setClipboardData({ data: url })
49
+ wx.showToast({
50
+ title: '链接已复制',
51
+ icon: 'success',
52
+ duration: 1500,
53
+ })
54
+ }
55
+ catch (error) {
56
+ // eslint-disable-next-line no-console
57
+ console.error('复制链接失败', error)
58
+ }
59
+ },
60
+ },
61
+ })
@@ -0,0 +1,16 @@
1
+ <view class="w-full max-w-[600rpx] mx-auto rounded-3xl p-8 bg-white/90 shadow-xl shadow-sky-200/40 dark:bg-slate-800/90 dark:shadow-slate-900/60 flex flex-col gap-2">
2
+ <view class="text-xl font-semibold text-sky-500 dark:text-sky-300">{{title}}</view>
3
+ <view class="text-xs leading-relaxed text-slate-700 dark:text-slate-200">{{description}}</view>
4
+ <view wx:if="{{links.length}}" class="flex flex-wrap gap-4">
5
+ <view
6
+ wx:for="{{links}}"
7
+ wx:key="url"
8
+ class="px-5 py-2 rounded-full text-sm font-medium transition active:scale-95 {{ item.variant === 'ghost' ? 'bg-slate-200 text-slate-800 dark:bg-slate-700 dark:text-slate-100' : 'bg-sky-500 text-white hover:bg-sky-600' }}"
9
+ data-url="{{item.url}}"
10
+ bindtap="copyLink"
11
+ >
12
+ {{item.text}}
13
+ </view>
14
+ </view>
15
+ <view wx:if="{{links.length}}" class="text-xs text-slate-400 dark:text-slate-500">点击按钮会将链接复制到剪贴板</view>
16
+ </view>
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "usingComponents": {
4
+ "HelloWorld": "/components/HelloWorld/HelloWorld"
5
+ },
6
+ "navigationBarTitleText": "初始模板"
7
+ }