@weapp-core/init 3.0.0 → 3.0.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 (39) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +1 -1
  3. package/package.json +2 -2
  4. package/templates/default/src/components/HelloWorld/HelloWorld.scss +47 -0
  5. package/templates/default/src/components/HelloWorld/HelloWorld.ts +60 -1
  6. package/templates/default/src/components/HelloWorld/HelloWorld.wxml +15 -3
  7. package/templates/default/src/pages/index/index.ts +18 -0
  8. package/templates/default/src/pages/index/index.wxml +6 -1
  9. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.scss +1 -0
  10. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.ts +60 -0
  11. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.wxml +16 -0
  12. package/templates/tailwindcss/src/pages/index/index.json +1 -1
  13. package/templates/tailwindcss/src/pages/index/index.ts +16 -0
  14. package/templates/tailwindcss/src/pages/index/index.wxml +6 -0
  15. package/templates/tailwindcss/src/pages/profile/index.json +7 -0
  16. package/templates/tailwindcss/src/pages/profile/index.ts +13 -0
  17. package/templates/tailwindcss/src/pages/profile/index.wxml +10 -7
  18. package/templates/tdesign/project.private.config.json +2 -2
  19. package/templates/tdesign/src/components/HelloWorld/HelloWorld.json +3 -1
  20. package/templates/tdesign/src/components/HelloWorld/HelloWorld.scss +1 -0
  21. package/templates/tdesign/src/components/HelloWorld/HelloWorld.ts +58 -0
  22. package/templates/tdesign/src/components/HelloWorld/HelloWorld.wxml +10 -0
  23. package/templates/tdesign/src/pages/index/index.ts +16 -0
  24. package/templates/tdesign/src/pages/index/index.wxml +6 -1
  25. package/templates/vant/project.private.config.json +2 -2
  26. package/templates/vant/src/components/{Navbar/Navbar.json → HelloWorld/HelloWorld.json} +3 -1
  27. package/templates/vant/src/components/HelloWorld/HelloWorld.scss +1 -0
  28. package/templates/vant/src/components/HelloWorld/HelloWorld.ts +60 -0
  29. package/templates/vant/src/components/HelloWorld/HelloWorld.wxml +19 -0
  30. package/templates/vant/src/pages/index/index.json +1 -1
  31. package/templates/vant/src/pages/index/index.ts +17 -1
  32. package/templates/vant/src/pages/index/index.wxml +6 -0
  33. package/templates/tailwindcss/src/components/Navbar/Navbar.scss +0 -0
  34. package/templates/tailwindcss/src/components/Navbar/Navbar.ts +0 -3
  35. package/templates/tailwindcss/src/components/Navbar/Navbar.wxml +0 -0
  36. package/templates/vant/src/components/Navbar/Navbar.scss +0 -0
  37. package/templates/vant/src/components/Navbar/Navbar.ts +0 -3
  38. package/templates/vant/src/components/Navbar/Navbar.wxml +0 -0
  39. /package/templates/tailwindcss/src/components/{Navbar/Navbar.json → HelloWorld/HelloWorld.json} +0 -0
package/dist/index.cjs CHANGED
@@ -704,7 +704,7 @@ var import_logger3 = __toESM(require("@weapp-core/logger"), 1);
704
704
  var import_fs_extra2 = __toESM(require("fs-extra"), 1);
705
705
 
706
706
  // ../../packages/weapp-vite/package.json
707
- var version = "5.2.0";
707
+ var version = "5.2.1";
708
708
 
709
709
  // src/enums.ts
710
710
  var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
package/dist/index.js CHANGED
@@ -656,7 +656,7 @@ import logger3 from "@weapp-core/logger";
656
656
  import fs2 from "fs-extra";
657
657
 
658
658
  // ../../packages/weapp-vite/package.json
659
- var version = "5.2.0";
659
+ var version = "5.2.1";
660
660
 
661
661
  // src/enums.ts
662
662
  var TemplateName = /* @__PURE__ */ ((TemplateName2) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-core/init",
3
3
  "type": "module",
4
- "version": "3.0.0",
4
+ "version": "3.0.1",
5
5
  "description": "@weapp-core/init",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -45,7 +45,7 @@
45
45
  "devDependencies": {
46
46
  "@types/semver": "^7.7.1",
47
47
  "fdir": "^6.5.0",
48
- "semver": "^7.7.2"
48
+ "semver": "^7.7.3"
49
49
  },
50
50
  "scripts": {
51
51
  "dev": "tsup --watch --sourcemap",
@@ -0,0 +1,47 @@
1
+ .hello-card {
2
+ width: 640rpx;
3
+ margin: 48rpx auto;
4
+ padding: 32rpx;
5
+ border-radius: 32rpx;
6
+ background: #ffffff;
7
+ box-shadow: 0 20rpx 60rpx rgba(15, 23, 42, 0.08);
8
+ display: flex;
9
+ flex-direction: column;
10
+ gap: 24rpx;
11
+ }
12
+
13
+ .hello-title {
14
+ font-size: 36rpx;
15
+ font-weight: 600;
16
+ color: #2563eb;
17
+ }
18
+
19
+ .hello-body {
20
+ font-size: 28rpx;
21
+ line-height: 1.6;
22
+ color: #334155;
23
+ }
24
+
25
+ .hello-actions {
26
+ display: flex;
27
+ flex-wrap: wrap;
28
+ gap: 20rpx;
29
+ }
30
+
31
+ .hello-button {
32
+ padding: 16rpx 32rpx;
33
+ border-radius: 999rpx;
34
+ background: #2563eb;
35
+ color: #ffffff;
36
+ font-size: 26rpx;
37
+ }
38
+
39
+ .hello-button--ghost {
40
+ background: #e2e8f0;
41
+ color: #1e293b;
42
+ }
43
+
44
+ .hello-tip {
45
+ font-size: 24rpx;
46
+ color: #94a3b8;
47
+ }
@@ -1 +1,60 @@
1
- Component({})
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
+ console.error('复制链接失败', error)
57
+ }
58
+ },
59
+ },
60
+ })
@@ -1,4 +1,16 @@
1
- <view style="text-align: center;">
2
- <view>hello weapp-vite!</view>
3
- <view>from src/components/HelloWorld/HelloWorld</view>
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>
4
16
  </view>
@@ -1,4 +1,22 @@
1
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
+ },
2
20
  onClick() {
3
21
  console.log('on click')
4
22
  },
@@ -5,5 +5,10 @@
5
5
  <view bind:tap="onClick">Hello World From Weapp-vite!</view>
6
6
  </view>
7
7
  </view>
8
- <HelloWorld></HelloWorld>
8
+ <HelloWorld
9
+ title="{{hello.title}}"
10
+ description="{{hello.description}}"
11
+ docs="{{hello.docs}}"
12
+ links="{{hello.links}}"
13
+ />
9
14
  </view>
@@ -0,0 +1 @@
1
+ /* Tailwind CSS utilities are applied directly in the template. */
@@ -0,0 +1,60 @@
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
+ console.error('复制链接失败', error)
57
+ }
58
+ },
59
+ },
60
+ })
@@ -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-6">
2
+ <view class="text-3xl font-semibold text-sky-500 dark:text-sky-300">{{title}}</view>
3
+ <view class="text-lg 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>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/page.json",
3
3
  "usingComponents": {
4
- "Navbar": "/components/Navbar/Navbar"
4
+ "HelloWorld": "/components/HelloWorld/HelloWorld"
5
5
  },
6
6
  "navigationBarTitleText": "初始模板"
7
7
  }
@@ -3,6 +3,22 @@ import { hello } from '@/utils/util'
3
3
  Page({
4
4
  data: {
5
5
  mode: 'light',
6
+ hello: {
7
+ title: 'Hello weapp-vite',
8
+ description: '这是一个集成 Tailwind CSS 的小程序模板,开箱即可体验原子化样式与完整的 HMR 流程。',
9
+ docs: 'https://vite.icebreaker.top',
10
+ links: [
11
+ {
12
+ text: '复制文档链接',
13
+ url: 'https://vite.icebreaker.top',
14
+ },
15
+ {
16
+ text: 'Tailwind Demo',
17
+ url: 'https://tw.icebreaker.top',
18
+ variant: 'ghost',
19
+ },
20
+ ],
21
+ },
6
22
  },
7
23
  switchMode() {
8
24
  if (this.data.mode === 'light') {
@@ -7,6 +7,12 @@
7
7
  <view class="bg-gradient-to-r from-green-400 to-sky-400 bg-clip-text text-xl font-extrabold text-transparent underline">
8
8
  weapp-vite & weapp-tailwindcss
9
9
  </view>
10
+ <HelloWorld
11
+ title="{{hello.title}}"
12
+ description="{{hello.description}}"
13
+ docs="{{hello.docs}}"
14
+ links="{{hello.links}}"
15
+ />
10
16
  <view class="{{ mode === 'light' ? 'i-mdi-moon-waxing-crescent':'i-mdi-weather-sunny text-white' }} text-8xl" bind:tap="switchMode"></view>
11
17
  <view class="underline" mark:url="https://vite.icebreaker.top" bind:tap="copy">
12
18
  https://vite.icebreaker.top
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "usingComponents": {
4
+ "HelloWorld": "/components/HelloWorld/HelloWorld"
5
+ },
6
+ "navigationBarTitleText": "个人中心"
7
+ }
@@ -1,4 +1,17 @@
1
1
  Page({
2
+ data: {
3
+ hello: {
4
+ title: 'Hello weapp-vite',
5
+ description: '这里是一个额外的页面示例,你可以继续拆分业务模块并复用组件。',
6
+ docs: 'https://vite.icebreaker.top',
7
+ links: [
8
+ {
9
+ text: '复制文档链接',
10
+ url: 'https://vite.icebreaker.top',
11
+ },
12
+ ],
13
+ },
14
+ },
2
15
  onClick() {
3
16
  console.log('on click')
4
17
  },
@@ -1,9 +1,12 @@
1
- <view>
2
- <Navbar />
3
- <view class="flex items-center justify-center">
4
- <view class="text-center">
5
- <image class="w-[200px] h-[190px]" src="/logo.png" />
6
- <view bind:tap="onClick">ice breaker</view>
7
- </view>
1
+ <view class="min-h-screen bg-gray-100 py-16">
2
+ <view class="flex flex-col items-center space-y-8">
3
+ <image class="w-[200px] h-[190px]" src="/logo.png" />
4
+ <view class="text-lg font-semibold" bind:tap="onClick">ice breaker</view>
5
+ <HelloWorld
6
+ title="{{hello.title}}"
7
+ description="{{hello.description}}"
8
+ docs="{{hello.docs}}"
9
+ links="{{hello.links}}"
10
+ />
8
11
  </view>
9
12
  </view>
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
- "projectname": "weapp-vite-tailwindcss-template",
3
+ "projectname": "weapp-vite-tailwindcss-tdesign-template",
4
4
  "setting": {
5
5
  "compileHotReLoad": false
6
6
  },
7
7
  "libVersion": "3.8.7"
8
- }
8
+ }
@@ -2,5 +2,7 @@
2
2
  "$schema": "https://vite.icebreaker.top/component.json",
3
3
  "component": true,
4
4
  "styleIsolation": "apply-shared",
5
- "usingComponents": {}
5
+ "usingComponents": {
6
+ "t-button": "tdesign-miniprogram/button/button"
7
+ }
6
8
  }
@@ -0,0 +1 @@
1
+ /* Tailwind CSS utilities are applied directly in the template. */
@@ -1,5 +1,63 @@
1
+ interface HelloWorldLink {
2
+ text: string
3
+ url: string
4
+ variant?: 'ghost'
5
+ }
6
+
1
7
  Component({
2
8
  options: {
3
9
  virtualHost: true,
4
10
  },
11
+ properties: {
12
+ title: {
13
+ type: String,
14
+ value: 'Hello weapp-vite',
15
+ },
16
+ description: {
17
+ type: String,
18
+ value: '欢迎使用 weapp-vite 模板,这里演示了如何在组件内快速放置介绍信息。',
19
+ },
20
+ docs: {
21
+ type: String,
22
+ value: '',
23
+ },
24
+ links: {
25
+ type: Array,
26
+ value: [] as HelloWorldLink[],
27
+ },
28
+ },
29
+ lifetimes: {
30
+ attached() {
31
+ if (!this.data.links?.length && this.data.docs) {
32
+ this.setData({
33
+ links: [
34
+ {
35
+ text: '复制文档链接',
36
+ url: this.data.docs,
37
+ },
38
+ ],
39
+ })
40
+ }
41
+ },
42
+ },
43
+ methods: {
44
+ async copyLink(event: WechatMiniprogram.TouchEvent) {
45
+ const url = event.currentTarget.dataset?.url as string | undefined
46
+ if (!url) {
47
+ return
48
+ }
49
+
50
+ try {
51
+ await wx.setClipboardData({ data: url })
52
+ wx.showToast({
53
+ title: '链接已复制',
54
+ icon: 'success',
55
+ duration: 1500,
56
+ })
57
+ }
58
+ catch (error) {
59
+ console.error('复制链接失败', error)
60
+ }
61
+ },
62
+ },
5
63
  })
@@ -5,3 +5,13 @@
5
5
  <view class="bg-gradient-to-r from-green-400 to-sky-400 bg-clip-text text-xl font-extrabold text-transparent underline">
6
6
  weapp-vite & weapp-tailwindcss
7
7
  </view>
8
+ <view class="w-full max-w-[640rpx] mx-auto rounded-3xl p-8 bg-white/95 shadow-xl shadow-slate-200/70 flex flex-col gap-6">
9
+ <view class="text-3xl font-semibold text-blue-600">{{title}}</view>
10
+ <view class="text-lg leading-relaxed text-slate-700">{{description}}</view>
11
+ <view wx:if="{{links.length}}" class="flex flex-wrap gap-4">
12
+ <t-button wx:for="{{links}}" wx:key="url" theme="{{item.variant === 'ghost' ? 'light' : 'primary'}}" variant="{{item.variant === 'ghost' ? 'outline' : 'base'}}" size="small" class="px-5 py-2 rounded-full text-sm font-medium transition active:scale-95" data-url="{{item.url}}" bindtap="copyLink">
13
+ {{item.text}}
14
+ </t-button>
15
+ </view>
16
+ <view wx:if="{{links.length}}" class="text-xs text-slate-400">点击按钮即可复制常用链接</view>
17
+ </view>
@@ -38,6 +38,22 @@ const firstGrid = [
38
38
  Page({
39
39
  data: {
40
40
  mode: 'light',
41
+ hello: {
42
+ title: 'Hello weapp-vite + TDesign',
43
+ description: '集成 TDesign Miniprogram 与 Tailwind CSS,帮助你快速搭建企业级交互界面。',
44
+ docs: 'https://vite.icebreaker.top',
45
+ links: [
46
+ {
47
+ text: '复制文档链接',
48
+ url: 'https://vite.icebreaker.top',
49
+ },
50
+ {
51
+ text: 'TDesign 小程序组件',
52
+ url: 'https://tdesign.tencent.com/miniprogram/overview',
53
+ variant: 'ghost',
54
+ },
55
+ ],
56
+ },
41
57
  },
42
58
  switchMode() {
43
59
  if (this.data.mode === 'light') {
@@ -1,6 +1,11 @@
1
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
2
  <view class="flex flex-col items-center pt-20 space-y-10">
3
- <HelloWorld></HelloWorld>
3
+ <HelloWorld
4
+ title="{{hello.title}}"
5
+ description="{{hello.description}}"
6
+ docs="{{hello.docs}}"
7
+ links="{{hello.links}}"
8
+ />
4
9
  <view bind:tap="switchMode" class="flex items-center">
5
10
  当前模式 {{mode}} 切换模式
6
11
  <view class="{{ mode === 'light' ? 'i-mdi-moon-waxing-crescent':'i-mdi-weather-sunny text-white' }} text-2xl"></view>
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
3
- "projectname": "weapp-vite-tailwindcss-template",
3
+ "projectname": "weapp-vite-tailwindcss-vant-template",
4
4
  "setting": {
5
5
  "compileHotReLoad": true
6
6
  },
7
7
  "libVersion": "development"
8
- }
8
+ }
@@ -3,5 +3,7 @@
3
3
  "component": true,
4
4
  // 组件需要设置成 "apply-shared" 才能使用 app.wxss 里的全局样式
5
5
  "styleIsolation": "apply-shared",
6
- "usingComponents": {}
6
+ "usingComponents": {
7
+ "van-button": "@vant/weapp/button/index"
8
+ }
7
9
  }
@@ -0,0 +1 @@
1
+ /* Tailwind CSS utilities are applied directly in the template. */
@@ -0,0 +1,60 @@
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
+ console.error('复制链接失败', error)
57
+ }
58
+ },
59
+ },
60
+ })
@@ -0,0 +1,19 @@
1
+ <view class="w-full max-w-[640rpx] mx-auto rounded-3xl p-8 bg-white/95 shadow-xl shadow-sky-200/40 flex flex-col gap-6">
2
+ <view class="text-3xl font-semibold text-sky-500">{{title}}</view>
3
+ <view class="text-lg leading-relaxed text-slate-700">{{description}}</view>
4
+ <view wx:if="{{links.length}}" class="flex flex-wrap gap-4">
5
+ <van-button
6
+ wx:for="{{links}}"
7
+ wx:key="url"
8
+ size="small"
9
+ type="{{item.variant === 'ghost' ? 'default' : 'primary'}}"
10
+ plain="{{item.variant === 'ghost'}}"
11
+ data-url="{{item.url}}"
12
+ bindtap="copyLink"
13
+ custom-class="px-5 py-2 rounded-full text-sm font-medium transition active:scale-95"
14
+ >
15
+ {{item.text}}
16
+ </van-button>
17
+ </view>
18
+ <view wx:if="{{links.length}}" class="text-xs text-slate-400">复制后可直接粘贴到浏览器访问</view>
19
+ </view>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://vite.icebreaker.top/page.json",
3
3
  "usingComponents": {
4
- "Navbar": "/components/Navbar/Navbar"
4
+ "HelloWorld": "/components/HelloWorld/HelloWorld"
5
5
  },
6
6
  "navigationBarTitleText": "初始模板"
7
7
  }
@@ -1,9 +1,25 @@
1
- import { hello } from '@/utils/util'
2
1
  import Dialog from '@vant/weapp/dialog/dialog'
2
+ import { hello } from '@/utils/util'
3
3
 
4
4
  Page({
5
5
  data: {
6
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
+ },
7
23
  },
8
24
  switchMode() {
9
25
  if (this.data.mode === 'light') {
@@ -7,6 +7,12 @@
7
7
  <view class="bg-gradient-to-r from-green-400 to-sky-400 bg-clip-text text-xl font-extrabold text-transparent underline">
8
8
  weapp-vite & weapp-tailwindcss
9
9
  </view>
10
+ <HelloWorld
11
+ title="{{hello.title}}"
12
+ description="{{hello.description}}"
13
+ docs="{{hello.docs}}"
14
+ links="{{hello.links}}"
15
+ />
10
16
  <view class="{{ mode === 'light' ? 'i-mdi-moon-waxing-crescent':'i-mdi-weather-sunny text-white' }} text-8xl" bind:tap="switchMode"></view>
11
17
  <view class="underline" mark:url="https://vite.icebreaker.top" bind:tap="copy">
12
18
  https://vite.icebreaker.top
@@ -1,3 +0,0 @@
1
- Component({
2
-
3
- })
File without changes
@@ -1,3 +0,0 @@
1
- Component({
2
-
3
- })
File without changes