create-weapp-vite 2.0.77 → 2.0.79

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 (48) hide show
  1. package/dist/cli.js +1 -1
  2. package/dist/index.js +1 -1
  3. package/dist/{src-6A45YX6O.js → src-BjkgG3qb.js} +7 -7
  4. package/package.json +2 -2
  5. package/templates/default/.vscode/settings.json +69 -0
  6. package/templates/default/package.json +2 -2
  7. package/templates/default/src/components/HelloWorld/HelloWorld.ts +4 -2
  8. package/templates/default/src/pages/index/index.ts +4 -2
  9. package/templates/default/src/pages/layouts/index.ts +3 -2
  10. package/templates/lib/.vscode/settings.json +69 -0
  11. package/templates/lib/package.json +3 -3
  12. package/templates/lib/src/components/HelloWorld/HelloWorld.ts +4 -2
  13. package/templates/lib/src/pages/index/index.ts +4 -2
  14. package/templates/lib/src/pages/layouts/index.ts +3 -2
  15. package/templates/tailwindcss/.vscode/settings.json +69 -0
  16. package/templates/tailwindcss/package.json +2 -2
  17. package/templates/tailwindcss/src/components/HelloWorld/HelloWorld.ts +4 -2
  18. package/templates/tailwindcss/src/pages/index/index.ts +4 -3
  19. package/templates/tailwindcss/src/pages/layouts/index.ts +3 -2
  20. package/templates/tdesign/.vscode/settings.json +69 -0
  21. package/templates/tdesign/package.json +2 -2
  22. package/templates/tdesign/src/components/HelloWorld/HelloWorld.ts +4 -2
  23. package/templates/tdesign/src/pages/index/index.ts +4 -3
  24. package/templates/tdesign/src/pages/layouts/index.ts +3 -2
  25. package/templates/vant/.vscode/settings.json +69 -0
  26. package/templates/vant/package.json +2 -2
  27. package/templates/vant/src/components/HelloWorld/HelloWorld.ts +4 -2
  28. package/templates/vant/src/pages/index/index.ts +4 -3
  29. package/templates/vant/src/pages/layouts/index.scss +1 -1
  30. package/templates/vant/src/pages/layouts/index.ts +3 -2
  31. package/templates/vant/src/pages/layouts/index.wxml +17 -5
  32. package/templates/wevu/.vscode/settings.json +69 -0
  33. package/templates/wevu/package.json +2 -2
  34. package/templates/wevu/src/app.vue +10 -7
  35. package/templates/wevu-tdesign/.vscode/settings.json +69 -0
  36. package/templates/wevu-tdesign/package.json +2 -2
  37. package/templates/wevu-tdesign/src/app.vue +6 -3
  38. package/templates/wevu-tdesign/src/components/FilterBar/index.vue +3 -2
  39. package/templates/wevu-tdesign/src/hooks/usePullDownRefresh.ts +6 -5
  40. package/templates/wevu-tdesign/src/pages/ability/index.vue +59 -55
  41. package/templates/wevu-tdesign/src/pages/data/index.vue +3 -2
  42. package/templates/wevu-tdesign/src/pages/form/index.vue +2 -20
  43. package/templates/wevu-tdesign/src/pages/index/index.vue +4 -3
  44. package/templates/wevu-tdesign/src/pages/layouts/index.vue +5 -4
  45. package/templates/wevu-tdesign/src/subpackages/ability/index.vue +4 -7
  46. package/templates/wevu-tdesign/src/subpackages/lab/class-binding/index.vue +5 -24
  47. package/templates/wevu-tdesign/src/subpackages/lab/index.vue +12 -10
  48. package/templates/wevu-tdesign/src/utils/changeEvent.ts +53 -0
@@ -1,4 +1,73 @@
1
1
  {
2
+ "prettier.enable": false,
3
+ "editor.formatOnSave": false,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": "explicit",
6
+ "source.organizeImports": "never"
7
+ },
8
+ "eslint.rules.customizations": [
9
+ {
10
+ "rule": "format/*",
11
+ "severity": "off"
12
+ },
13
+ {
14
+ "rule": "*-indent",
15
+ "severity": "off"
16
+ },
17
+ {
18
+ "rule": "*-spacing",
19
+ "severity": "off"
20
+ },
21
+ {
22
+ "rule": "*-spaces",
23
+ "severity": "off"
24
+ },
25
+ {
26
+ "rule": "*-order",
27
+ "severity": "off"
28
+ },
29
+ {
30
+ "rule": "*-dangle",
31
+ "severity": "off"
32
+ },
33
+ {
34
+ "rule": "*-newline",
35
+ "severity": "off"
36
+ },
37
+ {
38
+ "rule": "*quotes",
39
+ "severity": "off"
40
+ },
41
+ {
42
+ "rule": "*semi",
43
+ "severity": "off"
44
+ }
45
+ ],
46
+ "eslint.validate": [
47
+ "javascript",
48
+ "javascriptreact",
49
+ "typescript",
50
+ "typescriptreact",
51
+ "vue",
52
+ "html",
53
+ "markdown",
54
+ "json",
55
+ "jsonc",
56
+ "yaml",
57
+ "toml",
58
+ "xml",
59
+ "gql",
60
+ "graphql",
61
+ "astro",
62
+ "css",
63
+ "less",
64
+ "scss",
65
+ "pcss",
66
+ "postcss"
67
+ ],
68
+ "css.validate": false,
69
+ "less.validate": false,
70
+ "scss.validate": false,
2
71
  "files.associations": {
3
72
  "*.wxml": "html",
4
73
  "*.wxss": "css"
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@egoist/tailwindcss-icons": "catalog:",
35
- "@icebreakers/eslint-config": "^4.0.0",
36
- "@icebreakers/stylelint-config": "^3.0.0",
35
+ "@icebreakers/eslint-config": "^4.0.1",
36
+ "@icebreakers/stylelint-config": "^3.0.1",
37
37
  "@iconify-json/mdi": "catalog:",
38
38
  "autoprefixer": "catalog:",
39
39
  "eslint": "^10.2.0",
@@ -1,3 +1,5 @@
1
+ import { wpi } from '@wevu/api'
2
+
1
3
  interface HelloWorldLink {
2
4
  text: string
3
5
  url: string
@@ -45,8 +47,8 @@ Component({
45
47
  }
46
48
 
47
49
  try {
48
- await wx.setClipboardData({ data: url })
49
- wx.showToast({
50
+ await wpi.setClipboardData({ data: url })
51
+ await wpi.showToast({
50
52
  title: '链接已复制',
51
53
  icon: 'success',
52
54
  duration: 1500,
@@ -1,4 +1,5 @@
1
1
  import Dialog from '@vant/weapp/dialog/dialog'
2
+ import { wpi } from '@wevu/api'
2
3
  import { hello } from '@/utils/util'
3
4
 
4
5
  Page({
@@ -35,7 +36,7 @@ Page({
35
36
  },
36
37
  async copy(e: WechatMiniprogram.BaseEvent) {
37
38
  if (e.mark?.url) {
38
- await wx.setClipboardData({
39
+ await wpi.setClipboardData({
39
40
  data: e.mark.url,
40
41
  })
41
42
  // eslint-disable-next-line no-console
@@ -54,8 +55,8 @@ Page({
54
55
  // eslint-disable-next-line no-console
55
56
  console.log(hello())
56
57
  },
57
- goToLayouts() {
58
- wx.navigateTo({
58
+ async goToLayouts() {
59
+ await wpi.navigateTo({
59
60
  url: '/pages/layouts/index',
60
61
  })
61
62
  },
@@ -1,3 +1,3 @@
1
- .layout-btn {
1
+ .layout-actions__item + .layout-actions__item {
2
2
  margin-top: 24rpx;
3
3
  }
@@ -1,4 +1,5 @@
1
1
  import Dialog from '@vant/weapp/dialog/dialog'
2
+ import { wpi } from '@wevu/api'
2
3
  import { setPageLayout } from 'weapp-vite/runtime'
3
4
 
4
5
  Page({
@@ -29,7 +30,7 @@ Page({
29
30
  message: `当前状态:${this.data.currentLayout}`,
30
31
  })
31
32
  },
32
- backHome() {
33
- wx.navigateTo({ url: '/pages/index/index' })
33
+ async backHome() {
34
+ await wpi.navigateTo({ url: '/pages/index/index' })
34
35
  },
35
36
  })
@@ -6,11 +6,23 @@
6
6
  </view>
7
7
 
8
8
  <view class="mt-4 rounded-2xl bg-white p-5 shadow-sm">
9
- <van-button type="primary" bind:tap="applyDefaultLayout">使用 default 布局</van-button>
10
- <van-button custom-class="layout-btn" type="danger" plain bind:tap="applyAdminLayout">切到 admin 布局</van-button>
11
- <van-button custom-class="layout-btn" type="default" plain bind:tap="clearLayout">关闭布局</van-button>
12
- <van-button custom-class="layout-btn" type="success" plain bind:tap="showState">查看当前状态</van-button>
13
- <van-button custom-class="layout-btn" type="default" bind:tap="backHome">返回首页</van-button>
9
+ <view class="layout-actions">
10
+ <view class="layout-actions__item">
11
+ <van-button block type="primary" bind:tap="applyDefaultLayout">使用 default 布局</van-button>
12
+ </view>
13
+ <view class="layout-actions__item">
14
+ <van-button block type="danger" plain bind:tap="applyAdminLayout">切到 admin 布局</van-button>
15
+ </view>
16
+ <view class="layout-actions__item">
17
+ <van-button block type="default" plain bind:tap="clearLayout">关闭布局</van-button>
18
+ </view>
19
+ <view class="layout-actions__item">
20
+ <van-button block type="success" plain bind:tap="showState">查看当前状态</van-button>
21
+ </view>
22
+ <view class="layout-actions__item">
23
+ <van-button block type="default" bind:tap="backHome">返回首页</van-button>
24
+ </view>
25
+ </view>
14
26
  </view>
15
27
 
16
28
  <van-dialog id="van-dialog" />
@@ -1,4 +1,73 @@
1
1
  {
2
+ "prettier.enable": false,
3
+ "editor.formatOnSave": false,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": "explicit",
6
+ "source.organizeImports": "never"
7
+ },
8
+ "eslint.rules.customizations": [
9
+ {
10
+ "rule": "format/*",
11
+ "severity": "off"
12
+ },
13
+ {
14
+ "rule": "*-indent",
15
+ "severity": "off"
16
+ },
17
+ {
18
+ "rule": "*-spacing",
19
+ "severity": "off"
20
+ },
21
+ {
22
+ "rule": "*-spaces",
23
+ "severity": "off"
24
+ },
25
+ {
26
+ "rule": "*-order",
27
+ "severity": "off"
28
+ },
29
+ {
30
+ "rule": "*-dangle",
31
+ "severity": "off"
32
+ },
33
+ {
34
+ "rule": "*-newline",
35
+ "severity": "off"
36
+ },
37
+ {
38
+ "rule": "*quotes",
39
+ "severity": "off"
40
+ },
41
+ {
42
+ "rule": "*semi",
43
+ "severity": "off"
44
+ }
45
+ ],
46
+ "eslint.validate": [
47
+ "javascript",
48
+ "javascriptreact",
49
+ "typescript",
50
+ "typescriptreact",
51
+ "vue",
52
+ "html",
53
+ "markdown",
54
+ "json",
55
+ "jsonc",
56
+ "yaml",
57
+ "toml",
58
+ "xml",
59
+ "gql",
60
+ "graphql",
61
+ "astro",
62
+ "css",
63
+ "less",
64
+ "scss",
65
+ "pcss",
66
+ "postcss"
67
+ ],
68
+ "css.validate": false,
69
+ "less.validate": false,
70
+ "scss.validate": false,
2
71
  "files.associations": {
3
72
  "*.wxml": "html",
4
73
  "*.wxss": "css"
@@ -28,8 +28,8 @@
28
28
  "postinstall": "wv prepare"
29
29
  },
30
30
  "devDependencies": {
31
- "@icebreakers/eslint-config": "^4.0.0",
32
- "@icebreakers/stylelint-config": "^3.0.0",
31
+ "@icebreakers/eslint-config": "^4.0.1",
32
+ "@icebreakers/stylelint-config": "^3.0.1",
33
33
  "eslint": "^10.2.0",
34
34
  "miniprogram-api-typings": "catalog:",
35
35
  "stylelint": "^17.6.0",
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { wpi } from '@wevu/api'
2
3
  import autoRoutes from 'weapp-vite/auto-routes'
3
4
  import { onHide, onLaunch, onShow } from 'wevu'
4
5
  import { createRouter } from 'wevu/router'
@@ -16,6 +17,8 @@ defineAppJson({
16
17
  sitemapLocation: 'sitemap.json',
17
18
  })
18
19
 
20
+ const logger = wpi.getLogManager({ level: 1 })
21
+
19
22
  const router = createRouter({
20
23
  routes: autoRoutes.entries.map(path => ({
21
24
  name: path,
@@ -24,7 +27,7 @@ const router = createRouter({
24
27
  })
25
28
 
26
29
  router.beforeEach((to, from) => {
27
- wx.getLogManager({ level: 1 }).info('[wevu-template-router] beforeEach', {
30
+ logger.info('[wevu-template-router] beforeEach', {
28
31
  to: to?.fullPath,
29
32
  from: from.fullPath,
30
33
  })
@@ -32,7 +35,7 @@ router.beforeEach((to, from) => {
32
35
  })
33
36
 
34
37
  router.beforeResolve((to, from) => {
35
- wx.getLogManager({ level: 1 }).info('[wevu-template-router] beforeResolve', {
38
+ logger.info('[wevu-template-router] beforeResolve', {
36
39
  to: to?.fullPath,
37
40
  from: from.fullPath,
38
41
  })
@@ -40,7 +43,7 @@ router.beforeResolve((to, from) => {
40
43
  })
41
44
 
42
45
  router.afterEach((to, from, failure) => {
43
- wx.getLogManager({ level: 1 }).info('[wevu-template-router] afterEach', {
46
+ logger.info('[wevu-template-router] afterEach', {
44
47
  to: to?.fullPath,
45
48
  from: from.fullPath,
46
49
  failureType: failure?.type,
@@ -48,7 +51,7 @@ router.afterEach((to, from, failure) => {
48
51
  })
49
52
 
50
53
  router.onError((error, context) => {
51
- wx.getLogManager({ level: 1 }).info('[wevu-template-router] onError', {
54
+ logger.info('[wevu-template-router] onError', {
52
55
  error: error instanceof Error ? error.message : String(error),
53
56
  mode: context.mode,
54
57
  to: context.to?.fullPath,
@@ -58,15 +61,15 @@ router.onError((error, context) => {
58
61
  })
59
62
 
60
63
  onShow(() => {
61
- wx.getLogManager({ level: 1 }).info('[weapp-vite-wevu-template] app show')
64
+ logger.info('[weapp-vite-wevu-template] app show')
62
65
  })
63
66
 
64
67
  onHide(() => {
65
- wx.getLogManager({ level: 1 }).info('[weapp-vite-wevu-template] app hide')
68
+ logger.info('[weapp-vite-wevu-template] app hide')
66
69
  })
67
70
 
68
71
  onLaunch(() => {
69
- wx.getLogManager({ level: 1 }).info('[weapp-vite-wevu-template] app launch')
72
+ logger.info('[weapp-vite-wevu-template] app launch')
70
73
  })
71
74
  </script>
72
75
 
@@ -1,4 +1,73 @@
1
1
  {
2
+ "prettier.enable": false,
3
+ "editor.formatOnSave": false,
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll.eslint": "explicit",
6
+ "source.organizeImports": "never"
7
+ },
8
+ "eslint.rules.customizations": [
9
+ {
10
+ "rule": "format/*",
11
+ "severity": "off"
12
+ },
13
+ {
14
+ "rule": "*-indent",
15
+ "severity": "off"
16
+ },
17
+ {
18
+ "rule": "*-spacing",
19
+ "severity": "off"
20
+ },
21
+ {
22
+ "rule": "*-spaces",
23
+ "severity": "off"
24
+ },
25
+ {
26
+ "rule": "*-order",
27
+ "severity": "off"
28
+ },
29
+ {
30
+ "rule": "*-dangle",
31
+ "severity": "off"
32
+ },
33
+ {
34
+ "rule": "*-newline",
35
+ "severity": "off"
36
+ },
37
+ {
38
+ "rule": "*quotes",
39
+ "severity": "off"
40
+ },
41
+ {
42
+ "rule": "*semi",
43
+ "severity": "off"
44
+ }
45
+ ],
46
+ "eslint.validate": [
47
+ "javascript",
48
+ "javascriptreact",
49
+ "typescript",
50
+ "typescriptreact",
51
+ "vue",
52
+ "html",
53
+ "markdown",
54
+ "json",
55
+ "jsonc",
56
+ "yaml",
57
+ "toml",
58
+ "xml",
59
+ "gql",
60
+ "graphql",
61
+ "astro",
62
+ "css",
63
+ "less",
64
+ "scss",
65
+ "pcss",
66
+ "postcss"
67
+ ],
68
+ "css.validate": false,
69
+ "less.validate": false,
70
+ "scss.validate": false,
2
71
  "files.associations": {
3
72
  "*.wxml": "html",
4
73
  "*.wxss": "css"
@@ -32,8 +32,8 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@egoist/tailwindcss-icons": "catalog:",
35
- "@icebreakers/eslint-config": "^4.0.0",
36
- "@icebreakers/stylelint-config": "^3.0.0",
35
+ "@icebreakers/eslint-config": "^4.0.1",
36
+ "@icebreakers/stylelint-config": "^3.0.1",
37
37
  "@iconify-json/mdi": "catalog:",
38
38
  "autoprefixer": "catalog:",
39
39
  "eslint": "^10.2.0",
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { wpi } from '@wevu/api'
2
3
  import { onHide, onLaunch, onShow } from 'wevu'
3
4
 
4
5
  defineAppJson({
@@ -71,16 +72,18 @@ defineAppJson({
71
72
  sitemapLocation: 'sitemap.json',
72
73
  })
73
74
 
75
+ const logger = wpi.getLogManager({ level: 1 })
76
+
74
77
  onShow(() => {
75
- wx.getLogManager({ level: 1 }).info('[weapp-vite-wevu-template] app show')
78
+ logger.info('[weapp-vite-wevu-template] app show')
76
79
  })
77
80
 
78
81
  onHide(() => {
79
- wx.getLogManager({ level: 1 }).info('[weapp-vite-wevu-template] app hide')
82
+ logger.info('[weapp-vite-wevu-template] app hide')
80
83
  })
81
84
 
82
85
  onLaunch(() => {
83
- wx.getLogManager({ level: 1 }).info('[weapp-vite-wevu-template] app launch')
86
+ logger.info('[weapp-vite-wevu-template] app launch')
84
87
  })
85
88
  </script>
86
89
 
@@ -1,5 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import { computed } from 'wevu'
3
+ import { resolveStringChangeValue } from '@/utils/changeEvent'
3
4
 
4
5
  const props = withDefaults(defineProps<{
5
6
  query?: string
@@ -28,8 +29,8 @@ interface FilterItem {
28
29
 
29
30
  const filterItems = computed(() => (Array.isArray(props.filters) ? props.filters : []))
30
31
 
31
- function onQueryChange(e: WechatMiniprogram.CustomEvent<{ value: string }>) {
32
- emit('update:query', e.detail.value)
32
+ function onQueryChange(event: unknown) {
33
+ emit('update:query', resolveStringChangeValue(event, props.query))
33
34
  }
34
35
 
35
36
  function onSelect(value: string) {
@@ -1,11 +1,12 @@
1
+ import { wpi } from '@wevu/api'
1
2
  import { onPullDownRefresh } from 'wevu'
2
3
 
3
4
  export function usePullDownRefresh(refresh: () => void | Promise<void>) {
4
- onPullDownRefresh(() => {
5
- const result = refresh()
6
- if (result && typeof (result as Promise<void>).catch === 'function') {
7
- ;(result as Promise<void>).catch(() => {})
5
+ onPullDownRefresh(async () => {
6
+ try {
7
+ await refresh()
8
8
  }
9
- wx.stopPullDownRefresh()
9
+ catch {}
10
+ await wpi.stopPullDownRefresh()
10
11
  })
11
12
  }
@@ -1,4 +1,5 @@
1
1
  <script setup lang="ts">
2
+ import { wpi } from '@wevu/api'
2
3
  import { ref } from 'wevu'
3
4
 
4
5
  import SectionTitle from '@/components/SectionTitle/index.vue'
@@ -43,57 +44,56 @@ const capabilityCards = ref([
43
44
 
44
45
  const subscribeTemplateId = ''
45
46
 
46
- function handleCapability(key: string) {
47
- switch (key) {
48
- case 'scan':
49
- wx.scanCode({
50
- success: (result) => {
51
- showToast(`识别结果:${result.result || '已完成'}`)
52
- },
53
- fail: () => {
54
- showToast('扫码失败,请重试', 'warning')
55
- },
56
- })
57
- break
58
- case 'location':
59
- wx.getLocation({
60
- type: 'wgs84',
61
- success: (result) => {
62
- showToast(`定位成功:${result.latitude.toFixed(2)}, ${result.longitude.toFixed(2)}`)
63
- },
64
- fail: () => {
65
- showToast('未获取定位权限', 'warning')
66
- },
67
- })
68
- break
69
- case 'clipboard':
70
- wx.setClipboardData({
71
- data: 'weapp-vite + wevu + TDesign',
72
- success: () => showToast('已写入剪贴板'),
73
- })
74
- break
75
- case 'share':
76
- wx.showShareMenu({
77
- withShareTicket: true,
78
- success: () => showToast('已开启分享菜单'),
79
- fail: () => showToast('分享菜单开启失败', 'warning'),
80
- })
81
- break
82
- case 'image':
83
- wx.chooseImage({
84
- count: 3,
85
- success: (result) => {
86
- showToast(`已选择 ${result.tempFilePaths.length} 张图片`)
87
- },
88
- fail: () => showToast('未选择图片', 'warning'),
89
- })
90
- break
91
- default:
92
- break
47
+ async function handleCapability(key: string) {
48
+ try {
49
+ switch (key) {
50
+ case 'scan': {
51
+ const result = await wpi.scanCode()
52
+ showToast(`识别结果:${result.result || '已完成'}`)
53
+ break
54
+ }
55
+ case 'location': {
56
+ const result = await wpi.getLocation({
57
+ type: 'wgs84',
58
+ })
59
+ showToast(`定位成功:${result.latitude.toFixed(2)}, ${result.longitude.toFixed(2)}`)
60
+ break
61
+ }
62
+ case 'clipboard':
63
+ await wpi.setClipboardData({
64
+ data: 'weapp-vite + wevu + TDesign',
65
+ })
66
+ showToast('已写入剪贴板')
67
+ break
68
+ case 'share':
69
+ await wpi.showShareMenu({
70
+ withShareTicket: true,
71
+ })
72
+ showToast('已开启分享菜单')
73
+ break
74
+ case 'image': {
75
+ const result = await wpi.chooseImage({
76
+ count: 3,
77
+ })
78
+ showToast(`已选择 ${result.tempFilePaths.length} 张图片`)
79
+ break
80
+ }
81
+ default:
82
+ break
83
+ }
84
+ }
85
+ catch {
86
+ const warningMap: Record<string, string> = {
87
+ scan: '扫码失败,请重试',
88
+ location: '未获取定位权限',
89
+ share: '分享菜单开启失败',
90
+ image: '未选择图片',
91
+ }
92
+ showToast(warningMap[key] || '操作失败,请重试', 'warning')
93
93
  }
94
94
  }
95
95
 
96
- function requestSubscribe() {
96
+ async function requestSubscribe() {
97
97
  if (!subscribeTemplateId) {
98
98
  alert({
99
99
  title: '订阅消息',
@@ -102,15 +102,19 @@ function requestSubscribe() {
102
102
  })
103
103
  return
104
104
  }
105
- wx.requestSubscribeMessage({
106
- tmplIds: [subscribeTemplateId],
107
- success: () => showToast('订阅成功'),
108
- fail: () => showToast('订阅失败', 'warning'),
109
- })
105
+ try {
106
+ await wpi.requestSubscribeMessage({
107
+ tmplIds: [subscribeTemplateId],
108
+ })
109
+ showToast('订阅成功')
110
+ }
111
+ catch {
112
+ showToast('订阅失败', 'warning')
113
+ }
110
114
  }
111
115
 
112
- function navigateTo(url: string) {
113
- wx.navigateTo({
116
+ async function navigateTo(url: string) {
117
+ await wpi.navigateTo({
114
118
  url,
115
119
  })
116
120
  }
@@ -4,6 +4,7 @@ import { computed, ref, watch } from 'wevu'
4
4
  import KpiBoard from '@/components/KpiBoard/index.vue'
5
5
  import SectionTitle from '@/components/SectionTitle/index.vue'
6
6
  import TrendCard from '@/components/TrendCard/index.vue'
7
+ import { resolveStringChangeValue } from '@/utils/changeEvent'
7
8
 
8
9
  definePageJson({
9
10
  navigationBarTitleText: '数据',
@@ -91,8 +92,8 @@ const reportLines = computed(() => [
91
92
  '重点事项:提升转化 > 优化留存',
92
93
  ])
93
94
 
94
- function onRangeChange(e: WechatMiniprogram.CustomEvent<{ value: string }>) {
95
- activeRange.value = e.detail.value
95
+ function onRangeChange(event: unknown) {
96
+ activeRange.value = resolveStringChangeValue(event, activeRange.value)
96
97
  }
97
98
 
98
99
  watch(activeRange, () => {