create-weapp-vite 2.7.3 → 2.8.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.
Files changed (53) hide show
  1. package/README.md +14 -1
  2. package/dist/cli.js +9 -1
  3. package/dist/index.d.ts +2 -0
  4. package/dist/index.js +1 -1
  5. package/dist/{src-oq4dsVyY.js → src-C3T0ngLd.js} +30 -12
  6. package/package.json +3 -3
  7. package/templates/multi-platform/.editorconfig +9 -0
  8. package/templates/multi-platform/README.md +46 -0
  9. package/templates/multi-platform/config/alipay/mini.project.json +8 -0
  10. package/templates/multi-platform/config/jd/project.config.json +4 -0
  11. package/templates/multi-platform/config/swan/project.swan.json +8 -0
  12. package/templates/multi-platform/config/tt/project.config.json +10 -0
  13. package/templates/multi-platform/config/weapp/project.config.json +23 -0
  14. package/templates/multi-platform/config/xhs/project.config.json +10 -0
  15. package/templates/multi-platform/eslint.config.js +6 -0
  16. package/templates/multi-platform/gitignore +30 -0
  17. package/templates/multi-platform/index.html +13 -0
  18. package/templates/multi-platform/package.json +47 -0
  19. package/templates/multi-platform/src/app.json +13 -0
  20. package/templates/multi-platform/src/app.scss +5 -0
  21. package/templates/multi-platform/src/app.ts +3 -0
  22. package/templates/multi-platform/src/components/PlatformCard/index.json +5 -0
  23. package/templates/multi-platform/src/components/PlatformCard/index.scss +25 -0
  24. package/templates/multi-platform/src/components/PlatformCard/index.ts +8 -0
  25. package/templates/multi-platform/src/components/PlatformCard/index.wxml +5 -0
  26. package/templates/multi-platform/src/pages/index/index.json +7 -0
  27. package/templates/multi-platform/src/pages/index/index.scss +72 -0
  28. package/templates/multi-platform/src/pages/index/index.ts +12 -0
  29. package/templates/multi-platform/src/pages/index/index.wxml +22 -0
  30. package/templates/multi-platform/src/pages/index/platform.wxs +7 -0
  31. package/templates/multi-platform/src/sitemap.json +9 -0
  32. package/templates/multi-platform/stylelint.config.js +5 -0
  33. package/templates/multi-platform/tsconfig.json +17 -0
  34. package/templates/multi-platform/vite.config.ts +43 -0
  35. package/templates/multi-platform-sfc/.editorconfig +9 -0
  36. package/templates/multi-platform-sfc/README.md +43 -0
  37. package/templates/multi-platform-sfc/config/alipay/mini.project.json +8 -0
  38. package/templates/multi-platform-sfc/config/jd/project.config.json +4 -0
  39. package/templates/multi-platform-sfc/config/swan/project.swan.json +8 -0
  40. package/templates/multi-platform-sfc/config/tt/project.config.json +10 -0
  41. package/templates/multi-platform-sfc/config/weapp/project.config.json +23 -0
  42. package/templates/multi-platform-sfc/config/xhs/project.config.json +10 -0
  43. package/templates/multi-platform-sfc/eslint.config.js +7 -0
  44. package/templates/multi-platform-sfc/gitignore +30 -0
  45. package/templates/multi-platform-sfc/index.html +13 -0
  46. package/templates/multi-platform-sfc/package.json +48 -0
  47. package/templates/multi-platform-sfc/src/app.vue +19 -0
  48. package/templates/multi-platform-sfc/src/components/PlatformCard/index.vue +55 -0
  49. package/templates/multi-platform-sfc/src/pages/index/index.vue +134 -0
  50. package/templates/multi-platform-sfc/src/sitemap.json +9 -0
  51. package/templates/multi-platform-sfc/stylelint.config.js +5 -0
  52. package/templates/multi-platform-sfc/tsconfig.json +17 -0
  53. package/templates/multi-platform-sfc/vite.config.ts +26 -0
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
  ## 特性
8
8
 
9
9
  - 交互式创建或非交互式参数创建
10
- - 内置多种模板(默认、Wevu、Wevu + TDesign、Tailwindcss、TDesign、Vant、插件、组件库)
10
+ - 内置多种模板(默认、原生多平台 + Web、Vue SFC 多平台 + Web、Wevu、Wevu + TDesign、Tailwindcss、TDesign、Vant、插件、组件库)
11
11
  - 自动对齐 `weapp-vite` 与 `wevu` 版本
12
12
  - 自动处理 `.gitignore` 写入
13
13
  - 可选安装推荐的 AI skills(`sonofmagic/skills`)
@@ -45,6 +45,12 @@ npx skills add sonofmagic/skills
45
45
  ```bash
46
46
  pnpm create weapp-vite my-app wevu
47
47
 
48
+ # 原生多平台 + Web 模板
49
+ pnpm create weapp-vite my-app multi-platform
50
+
51
+ # Vue SFC 多平台 + Web 模板
52
+ pnpm create weapp-vite my-app multi-platform-sfc
53
+
48
54
  # 显式安装推荐 skills
49
55
  pnpm create weapp-vite my-app wevu --install-skills
50
56
 
@@ -66,7 +72,10 @@ await createProject('my-app', TemplateName.wevu, { installSkills: true })
66
72
  `TemplateName` 支持以下模板:
67
73
 
68
74
  - `default`
75
+ - `multi-platform`
76
+ - `multi-platform-sfc`
69
77
  - `wevu`
78
+ - `react`
70
79
  - `wevu-tdesign`
71
80
  - `tailwindcss`
72
81
  - `tdesign`
@@ -74,6 +83,10 @@ await createProject('my-app', TemplateName.wevu, { installSkills: true })
74
83
  - `plugin`
75
84
  - `lib`
76
85
 
86
+ `multi-platform` 使用原生 Page/Component,覆盖微信、支付宝、抖音、百度、京东、小红书与 Web Runtime。它按命令构建单个目标,不会隐式生成全部平台产物;创建后请使用 `dev:<platform>` / `build:<platform>` 脚本。
87
+
88
+ `multi-platform-sfc` 使用 Wevu + Vue SFC 覆盖相同目标,并提供 `defineAppJson` / `definePageJson` / `defineComponentJson`、受管类型文件和稳定响应式交互示例。Web Runtime 用于浏览器联调,不能替代目标小程序 IDE 或真机验收。
89
+
77
90
  ## 相关链接
78
91
 
79
92
  - weapp-vite 文档:https://vite.icebreaker.top/
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as RECOMMENDED_SKILLS_INSTALL_COMMAND, t as createProject } from "./src-oq4dsVyY.js";
1
+ import { n as RECOMMENDED_SKILLS_INSTALL_COMMAND, t as createProject } from "./src-C3T0ngLd.js";
2
2
  import logger from "@weapp-core/logger";
3
3
  import { fs } from "@weapp-core/shared/fs";
4
4
  import process from "node:process";
@@ -12,6 +12,14 @@ const TEMPLATE_CHOICES = [
12
12
  name: "默认模板",
13
13
  value: "default"
14
14
  },
15
+ {
16
+ name: "原生多平台 + Web 模板",
17
+ value: "multi-platform"
18
+ },
19
+ {
20
+ name: "Vue SFC 多平台 + Web 模板",
21
+ value: "multi-platform-sfc"
22
+ },
15
23
  {
16
24
  name: "Wevu 模板 (Vue SFC)",
17
25
  value: "wevu"
package/dist/index.d.ts CHANGED
@@ -2,6 +2,8 @@ import "pkg-types";
2
2
  //#region src/enums.d.ts
3
3
  declare enum TemplateName {
4
4
  default = "default",
5
+ multiPlatform = "multi-platform",
6
+ multiPlatformSfc = "multi-platform-sfc",
5
7
  plugin = "plugin",
6
8
  wevu = "wevu",
7
9
  tailwindcss = "tailwindcss",
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { r as TemplateName, t as createProject } from "./src-oq4dsVyY.js";
1
+ import { r as TemplateName, t as createProject } from "./src-C3T0ngLd.js";
2
2
  export { TemplateName, createProject };
@@ -9,17 +9,19 @@ import process from "node:process";
9
9
  var version$3 = "0.2.0";
10
10
  //#endregion
11
11
  //#region ../../packages-runtime/wevu/package.json
12
- var version$2 = "6.20.3";
12
+ var version$2 = "6.20.4";
13
13
  //#endregion
14
14
  //#region ../dashboard/package.json
15
- var version$1 = "6.20.3";
15
+ var version$1 = "6.20.4";
16
16
  //#endregion
17
17
  //#region ../weapp-vite/package.json
18
- var version = "6.20.3";
18
+ var version = "6.20.4";
19
19
  //#endregion
20
20
  //#region src/enums.ts
21
21
  let TemplateName = /* @__PURE__ */ function(TemplateName) {
22
22
  TemplateName["default"] = "default";
23
+ TemplateName["multiPlatform"] = "multi-platform";
24
+ TemplateName["multiPlatformSfc"] = "multi-platform-sfc";
23
25
  TemplateName["plugin"] = "plugin";
24
26
  TemplateName["wevu"] = "wevu";
25
27
  TemplateName["tailwindcss"] = "tailwindcss";
@@ -33,14 +35,24 @@ let TemplateName = /* @__PURE__ */ function(TemplateName) {
33
35
  //#endregion
34
36
  //#region src/agents.ts
35
37
  function supportsWevu(templateName) {
36
- return ["wevu", "wevu-tdesign"].includes(templateName);
38
+ return [
39
+ "wevu",
40
+ "wevu-tdesign",
41
+ "multi-platform-sfc"
42
+ ].includes(templateName);
43
+ }
44
+ function supportsReact(templateName) {
45
+ return templateName === "react";
37
46
  }
38
47
  function supportsNativePages(templateName) {
39
- return !supportsWevu(templateName);
48
+ return !supportsWevu(templateName) && !supportsReact(templateName);
40
49
  }
41
50
  function supportsPlugin(templateName) {
42
51
  return templateName === "plugin";
43
52
  }
53
+ function supportsMultiPlatform(templateName) {
54
+ return ["multi-platform", "multi-platform-sfc"].includes(templateName);
55
+ }
44
56
  /**
45
57
  * @description 生成新项目的 AGENTS 指引
46
58
  */
@@ -95,13 +107,15 @@ function createAgentsGuidelines(templateName) {
95
107
  "- In Codex/Claude environments, prefer these skills first when available:",
96
108
  " - `$weapp-vite-best-practices` for config, build, subpackage, route, DevTools CLI orchestration, and screenshot/compare command work.",
97
109
  " - `$weapp-vite-vue-sfc-best-practices` for `.vue` SFC macros, JSON blocks, and template compatibility.",
98
- " - `$release-and-changeset-best-practices` for issue delivery, changesets, release decisions, and PR workflow.",
110
+ " - `$release-and-changeset-best-practices` for issue delivery, pnpm change intents, repoctl release decisions, and PR workflow.",
99
111
  " - `$docs-and-website-sync` when documentation or AI guidance must be refreshed together with code changes.",
100
112
  " - Use `$weapp-vite-best-practices` for stateful HMR, pluginRoot/dist-plugin, Web runtime compatibility, and native AST profiling; use `$wevu-best-practices` for `wevu/router` navigation semantics.",
101
113
  " - Use `$weapp-devtools-e2e-best-practices` for serialized DevTools runtime suites, shared automator sessions, and known host compatibility skips."
102
114
  ];
103
115
  if (supportsWevu(templateName)) lines.push(" - `$wevu-best-practices` for `wevu` runtime lifecycle, state, store, and event contracts.", "", "## Wevu Authoring", "", "- Import runtime APIs from `wevu` in business code.", "- Register lifecycle hooks synchronously in `setup()` and avoid hook registration after `await`.", "- Prefer `ref`, `reactive`, `computed`, and explicit event contracts over large opaque state writes.", "- Use `storeToRefs` when destructuring store state/getters.", "- Treat mini-program runtime constraints as primary; do not assume Vue web-only behavior.");
116
+ if (supportsReact(templateName)) lines.push(" - `$weapp-vite-react-best-practices` for React 19 JSX/TSX ownership, render modes, root lifecycle, React Compiler, and native/Wevu component bridges.", "", "## React Mini-program Authoring", "", "- Keep `weapp.react` as the project-level owner for all `.jsx` and `.tsx` modules; do not mix Wevu JSX in the same build.", "- Use React 19.2.x, `react-reconciler` 0.33.x, and `@weapp-vite/react` without `react-dom`.", "- Start with `renderMode: 'auto'`; use `dynamic` only for reconciler-tree diagnostics and `static` for strict static-shape validation.", "- Create and unmount `createReactMiniProgramRoot` in the native page/component lifecycle, and forward host events through the root.", "- Register native or Wevu custom components in `usingComponents` before declaring a top-level `createNativeComponent()` bridge in the current TSX file.", "- Treat the current React runtime as WeChat-only; Web, Alipay, and Douyin builds are not runtime compatibility evidence.");
104
117
  if (supportsNativePages(templateName)) lines.push(" - `$native-to-weapp-vite-wevu-migration` when migrating native mini-program projects to `weapp-vite + native`, or further toward Vue SFC / wevu.", "", "## Native Mini-program Authoring", "", "- Keep native page/component structure consistent with the template unless there is a clear migration goal.", "- Prefer `weapp-vite generate` or `wv generate` for new app/page/component scaffolds.", "- If migrating this project, first decide whether the target is `weapp-vite + native` or a further Vue SFC / `wevu` migration, then keep each migration wave explicit.");
118
+ if (supportsMultiPlatform(templateName)) lines.push("", "## Multi-platform Workflow", "", "- This project builds one target at a time. Always pass an explicit platform or use `pnpm dev:<platform>` / `pnpm build:<platform>`.", "- Keep platform IDE configuration under `config/<platform>` and import `dist/<platform>` into the matching mini-program IDE.", "- Use `pnpm dev:web` for browser compatibility work, but keep mini-program DevTools or device acceptance as the release authority.", "- Treat WeChat, Web, official IDE compilation, and unsupported automator targets as separate verification layers; do not report a build-only check as runtime E2E.");
105
119
  if (supportsPlugin(templateName)) lines.push("", "## Plugin Authoring", "", "- Keep `src/` as the host app source and `plugin/` as the plugin source root declared by `weapp.pluginRoot`.", "- Validate both `dist/` and `dist-plugin/` outputs after structural changes to host pages, plugin pages, or plugin public components.", "- If you change plugin AppID or switch away from local `dev` linkage, update both `project.config.json.appid` and `src/app.json` -> `plugins.*.provider` together.", "- Treat shared modules under `shared/` as regular source code that can be imported by both host and plugin entries.");
106
120
  return `${lines.join("\n")}\n`;
107
121
  }
@@ -406,6 +420,8 @@ const TOURIST_APP_ID = "touristappid";
406
420
  const moduleDir = path.dirname(fileURLToPath(import.meta.url));
407
421
  const TEMPLATE_DIR_MAP = {
408
422
  ["default"]: "weapp-vite-template",
423
+ ["multi-platform"]: "weapp-vite-multi-platform-template",
424
+ ["multi-platform-sfc"]: "weapp-vite-multi-platform-sfc-template",
409
425
  ["plugin"]: "weapp-vite-plugin-template",
410
426
  ["lib"]: "weapp-vite-lib-template",
411
427
  ["wevu"]: "weapp-vite-wevu-template",
@@ -485,12 +501,14 @@ async function ensureDotGitignore(root) {
485
501
  await fs.move(gitignorePath, dotGitignorePath);
486
502
  }
487
503
  async function rewriteProjectConfigAppId(targetDir) {
488
- const projectConfigPath = path.resolve(targetDir, "project.config.json");
489
- if (!await fs.pathExists(projectConfigPath)) return;
490
- const projectConfig = await fs.readJSON(projectConfigPath);
491
- if (!projectConfig || typeof projectConfig !== "object" || projectConfig.compileType === "plugin" || projectConfig.appid === TOURIST_APP_ID) return;
492
- projectConfig.appid = TOURIST_APP_ID;
493
- await writeJsonFile(projectConfigPath, projectConfig);
504
+ const projectConfigPaths = [path.resolve(targetDir, "project.config.json"), path.resolve(targetDir, "config/weapp/project.config.json")];
505
+ for (const projectConfigPath of projectConfigPaths) {
506
+ if (!await fs.pathExists(projectConfigPath)) continue;
507
+ const projectConfig = await fs.readJSON(projectConfigPath);
508
+ if (!projectConfig || typeof projectConfig !== "object" || projectConfig.compileType === "plugin" || projectConfig.appid === TOURIST_APP_ID) continue;
509
+ projectConfig.appid = TOURIST_APP_ID;
510
+ await writeJsonFile(projectConfigPath, projectConfig);
511
+ }
494
512
  }
495
513
  function createEmptyPackageJson() {
496
514
  return {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "create-weapp-vite",
3
3
  "type": "module",
4
- "version": "2.7.3",
4
+ "version": "2.8.0",
5
5
  "description": "create-weapp-vite",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -50,8 +50,8 @@
50
50
  "pathe": "^2.0.3",
51
51
  "pkg-types": "^2.3.1",
52
52
  "@weapp-core/init": "6.0.14",
53
- "@weapp-core/logger": "3.1.1",
54
- "@weapp-core/shared": "3.1.1"
53
+ "@weapp-core/shared": "3.1.1",
54
+ "@weapp-core/logger": "3.1.1"
55
55
  },
56
56
  "scripts": {
57
57
  "catalog:sync": "node --import tsx scripts/generate-template-catalog.ts",
@@ -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,46 @@
1
+ # weapp-vite 原生多平台 + Web 模板
2
+
3
+ 这个模板使用同一份原生小程序源码,按命令选择单个目标平台构建。当前覆盖微信、支付宝、抖音、百度、京东、小红书和 Web Runtime。
4
+
5
+ ```sh
6
+ pnpm create weapp-vite my-app multi-platform
7
+ cd my-app
8
+ pnpm install
9
+ pnpm dev:weapp
10
+ ```
11
+
12
+ ## 开发
13
+
14
+ ```sh
15
+ pnpm dev:weapp
16
+ pnpm dev:alipay
17
+ pnpm dev:tt
18
+ pnpm dev:swan
19
+ pnpm dev:jd
20
+ pnpm dev:xhs
21
+ pnpm dev:web
22
+ ```
23
+
24
+ `pnpm dev` 默认等价于 `pnpm dev:weapp`。需要打开开发者工具时使用 `pnpm dev:open`、`pnpm open:weapp` 或 `pnpm open:alipay`。
25
+
26
+ ## 构建
27
+
28
+ ```sh
29
+ pnpm build:weapp
30
+ pnpm build:alipay
31
+ pnpm build:tt
32
+ pnpm build:swan
33
+ pnpm build:jd
34
+ pnpm build:xhs
35
+ pnpm build:web
36
+ ```
37
+
38
+ 每条命令只构建一个目标。小程序产物位于 `dist/<platform>/dist`,对应的 IDE 项目位于 `dist/<platform>`;Web 产物位于 `dist/web`。
39
+
40
+ ## 平台配置
41
+
42
+ 各平台项目配置位于 `config/<platform>`。创建项目后请先替换目标平台的 AppID,再导入对应的 `dist/<platform>` 目录。
43
+
44
+ 便携源码使用原生 `Page()` / `Component()`,公共模板采用 WXML 语法,并通过 `wx` API 编写平台无关逻辑。构建时 `injectWeapi.replaceWx` 会替换运行时 API,模板、样式、事件和脚本模块后缀会按目标平台转换。平台专属能力应隔离在独立模块或条件入口中,避免让公共页面直接依赖某个宿主的 TypeScript 类型。
45
+
46
+ Web Runtime 适合浏览器联调和兼容验证,不能替代小程序开发者工具或真机验收。构建通过也不等于官方 IDE 编译或 Runtime 交互通过:微信和 Web 可以做自动化交互验收,支付宝使用官方 `minidev build` 做 IDE 编译检查,百度 Runtime 依赖可用的 WebSocket 端点,抖音、京东和小红书仍需在各自官方工具中人工复验。详细说明见 [多平台构建指南](https://vite.icebreaker.top/guide/multi-platform)。
@@ -0,0 +1,8 @@
1
+ {
2
+ "format": 2,
3
+ "compileType": "mini",
4
+ "miniprogramRoot": "dist",
5
+ "compileOptions": {
6
+ "typescript": false
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "appid": "your_appid",
3
+ "miniprogramRoot": "dist"
4
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "smartProgramRoot": "dist",
3
+ "appid": "your_appid",
4
+ "compileType": "miniprogram",
5
+ "setting": {
6
+ "urlCheck": true
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "appid": "your_appid",
3
+ "projectname": "weapp-vite-multi-platform-template",
4
+ "miniprogramRoot": "dist",
5
+ "setting": {
6
+ "es6": true,
7
+ "urlCheck": false,
8
+ "compileHotReLoad": false
9
+ }
10
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "description": "weapp-vite 多平台模板",
3
+ "miniprogramRoot": "dist",
4
+ "srcMiniprogramRoot": "dist",
5
+ "compileType": "miniprogram",
6
+ "setting": {
7
+ "babelSetting": {
8
+ "ignore": [],
9
+ "disablePlugins": [],
10
+ "outputPath": ""
11
+ },
12
+ "postcss": false,
13
+ "minified": false,
14
+ "ignoreUploadUnusedFiles": true,
15
+ "compileHotReLoad": false,
16
+ "packNpmManually": true,
17
+ "es6": true
18
+ },
19
+ "simulatorType": "wechat",
20
+ "libVersion": "3.13.2",
21
+ "condition": {},
22
+ "appid": "wxb3d842a4a7e3440d"
23
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "description": "weapp-vite 多平台模板",
3
+ "miniprogramRoot": "dist",
4
+ "compileType": "miniprogram",
5
+ "setting": {
6
+ "es6": true,
7
+ "compileHotReload": false
8
+ },
9
+ "appid": "your_appid"
10
+ }
@@ -0,0 +1,6 @@
1
+ import { icebreaker } from '@icebreakers/eslint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ ignores: ['CHANGELOG.md', 'README.md', '.turbo/**', 'dist/**', '.weapp-vite/**'],
6
+ })
@@ -0,0 +1,30 @@
1
+ # dependencies
2
+ node_modules
3
+ .pnp
4
+ .pnp.js
5
+
6
+ # testing
7
+ coverage
8
+
9
+ # misc
10
+ .DS_Store
11
+ *.pem
12
+
13
+ # debug
14
+ npm-debug.log*
15
+ yarn-debug.log*
16
+ yarn-error.log*
17
+ .pnpm-debug.log*
18
+
19
+ # local env files
20
+ .env.local
21
+ .env.development.local
22
+ .env.test.local
23
+ .env.production.local
24
+
25
+ # turbo
26
+ .turbo
27
+
28
+ dist
29
+ vite.config.ts.timestamp-*.mjs
30
+ .weapp-vite/
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" href="data:," />
7
+ <title>weapp-vite 多平台模板</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/@weapp-vite/web/entry"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "weapp-vite-multi-platform-template",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "description": "weapp-vite 原生多平台与 Web 模板",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "dev": "wv dev -p weapp",
10
+ "dev:weapp": "wv dev -p weapp",
11
+ "dev:alipay": "wv dev -p alipay",
12
+ "dev:tt": "wv dev -p tt",
13
+ "dev:swan": "wv dev -p swan",
14
+ "dev:jd": "wv dev -p jd",
15
+ "dev:xhs": "wv dev -p xhs",
16
+ "dev:web": "wv dev -p web --host",
17
+ "dev:open": "wv dev -p weapp -o",
18
+ "build": "wv build -p weapp",
19
+ "build:weapp": "wv build -p weapp",
20
+ "build:alipay": "wv build -p alipay",
21
+ "build:tt": "wv build -p tt",
22
+ "build:swan": "wv build -p swan",
23
+ "build:jd": "wv build -p jd",
24
+ "build:xhs": "wv build -p xhs",
25
+ "build:web": "wv build -p web",
26
+ "open:weapp": "wv open -p weapp",
27
+ "open:alipay": "wv open -p alipay",
28
+ "lint": "eslint .",
29
+ "lint:fix": "eslint . --fix",
30
+ "stylelint": "stylelint \"src/**/*.{css,scss,vue,wxss}\" --allow-empty-input",
31
+ "stylelint:fix": "stylelint \"src/**/*.{css,scss,vue,wxss}\" --fix --allow-empty-input",
32
+ "g": "wv generate",
33
+ "postinstall": "wv prepare -p weapp"
34
+ },
35
+ "devDependencies": {
36
+ "@icebreakers/eslint-config": "catalog:",
37
+ "@icebreakers/stylelint-config": "catalog:",
38
+ "@types/node": "catalog:",
39
+ "@weapp-vite/dashboard": "workspace:*",
40
+ "eslint": "catalog:",
41
+ "miniprogram-api-typings": "catalog:",
42
+ "sass": "catalog:",
43
+ "stylelint": "catalog:",
44
+ "typescript": "catalog:",
45
+ "weapp-vite": "workspace:*"
46
+ }
47
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/app.json",
3
+ "pages": [
4
+ "pages/index/index"
5
+ ],
6
+ "window": {
7
+ "navigationBarTitleText": "多平台模板",
8
+ "navigationBarBackgroundColor": "#ffffff",
9
+ "navigationBarTextStyle": "black",
10
+ "backgroundColor": "#f4f6f8"
11
+ },
12
+ "sitemapLocation": "sitemap.json"
13
+ }
@@ -0,0 +1,5 @@
1
+ page {
2
+ min-height: 100%;
3
+ color: #17212b;
4
+ background: #f4f6f8;
5
+ }
@@ -0,0 +1,3 @@
1
+ App({
2
+ globalData: {},
3
+ })
@@ -0,0 +1,5 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/component.json",
3
+ "component": true,
4
+ "styleIsolation": "apply-shared"
5
+ }
@@ -0,0 +1,25 @@
1
+ .platform-card {
2
+ padding: 32rpx;
3
+ background: #fff;
4
+ border: 2rpx solid #d8dee4;
5
+ border-radius: 12rpx;
6
+ }
7
+
8
+ .platform-card__label {
9
+ font-size: 24rpx;
10
+ color: #66717d;
11
+ }
12
+
13
+ .platform-card__value {
14
+ margin-top: 10rpx;
15
+ font-size: 44rpx;
16
+ font-weight: 700;
17
+ color: #0969da;
18
+ }
19
+
20
+ .platform-card__hint {
21
+ margin-top: 18rpx;
22
+ font-size: 26rpx;
23
+ line-height: 1.6;
24
+ color: #3d4852;
25
+ }
@@ -0,0 +1,8 @@
1
+ Component({
2
+ properties: {
3
+ platform: {
4
+ type: String,
5
+ value: 'unknown',
6
+ },
7
+ },
8
+ })
@@ -0,0 +1,5 @@
1
+ <view class="platform-card">
2
+ <view class="platform-card__label">当前构建目标</view>
3
+ <view class="platform-card__value">{{platform}}</view>
4
+ <view class="platform-card__hint">同一份原生源码由 weapp-vite 转换为目标平台产物</view>
5
+ </view>
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/page.json",
3
+ "navigationBarTitleText": "多平台模板",
4
+ "usingComponents": {
5
+ "PlatformCard": "/components/PlatformCard/index"
6
+ }
7
+ }
@@ -0,0 +1,72 @@
1
+ .page-shell {
2
+ box-sizing: border-box;
3
+ min-height: 100vh;
4
+ padding: 72rpx 32rpx 48rpx;
5
+ }
6
+
7
+ .page-heading {
8
+ margin-bottom: 32rpx;
9
+ }
10
+
11
+ .page-heading__eyebrow {
12
+ font-size: 24rpx;
13
+ font-weight: 600;
14
+ color: #1a7f37;
15
+ }
16
+
17
+ .page-heading__title {
18
+ margin-top: 12rpx;
19
+ font-size: 52rpx;
20
+ font-weight: 700;
21
+ color: #17212b;
22
+ }
23
+
24
+ .page-heading__description {
25
+ margin-top: 16rpx;
26
+ font-size: 28rpx;
27
+ line-height: 1.6;
28
+ color: #57606a;
29
+ }
30
+
31
+ .runtime-marker,
32
+ .runtime-status {
33
+ font-family: monospace;
34
+ font-size: 24rpx;
35
+ color: #57606a;
36
+ }
37
+
38
+ .runtime-status {
39
+ margin: 8rpx 0 28rpx;
40
+ }
41
+
42
+ .counter-panel {
43
+ padding: 32rpx;
44
+ margin-top: 24rpx;
45
+ text-align: center;
46
+ background: #fff;
47
+ border: 2rpx solid #d8dee4;
48
+ border-radius: 12rpx;
49
+ }
50
+
51
+ .counter-panel__label {
52
+ font-size: 26rpx;
53
+ color: #57606a;
54
+ }
55
+
56
+ .counter-panel__value {
57
+ margin: 18rpx 0;
58
+ font-size: 64rpx;
59
+ font-weight: 700;
60
+ color: #17212b;
61
+ }
62
+
63
+ .counter-panel__button {
64
+ width: 100%;
65
+ color: #fff;
66
+ background: #1f883d;
67
+ border-radius: 8rpx;
68
+ }
69
+
70
+ .counter-panel__button::after {
71
+ border: 0;
72
+ }
@@ -0,0 +1,12 @@
1
+ Page({
2
+ data: {
3
+ platform: import.meta.env.PLATFORM,
4
+ status: 'ready',
5
+ count: 0,
6
+ },
7
+ increment() {
8
+ this.setData({
9
+ count: this.data.count + 1,
10
+ })
11
+ },
12
+ })
@@ -0,0 +1,22 @@
1
+ <wxs module="platformTools" src="./platform.wxs" />
2
+
3
+ <view class="page-shell">
4
+ <view class="page-heading">
5
+ <view class="page-heading__eyebrow">weapp-vite</view>
6
+ <view class="page-heading__title">原生多平台 + Web</view>
7
+ <view class="page-heading__description">一次维护,按目标平台独立构建和验收。</view>
8
+ </view>
9
+
10
+ <view id="platform-marker" class="runtime-marker">MP_PLATFORM={{platformTools.label(platform)}}</view>
11
+ <view id="runtime-status" class="runtime-status">status={{status}}</view>
12
+
13
+ <PlatformCard platform="{{platform}}" />
14
+
15
+ <view class="counter-panel">
16
+ <view class="counter-panel__label">跨端交互检查</view>
17
+ <view id="counter-value" class="counter-panel__value">{{count}}</view>
18
+ <button id="increment-button" class="counter-panel__button" bind:tap="increment">
19
+ 增加计数
20
+ </button>
21
+ </view>
22
+ </view>
@@ -0,0 +1,7 @@
1
+ function label(value) {
2
+ return value || 'unknown'
3
+ }
4
+
5
+ module.exports = {
6
+ label: label,
7
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://vite.icebreaker.top/sitemap.json",
3
+ "rules": [
4
+ {
5
+ "action": "allow",
6
+ "page": "*"
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,5 @@
1
+ import { icebreaker } from '@icebreakers/stylelint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ })
@@ -0,0 +1,17 @@
1
+ {
2
+ "references": [
3
+ {
4
+ "path": "./.weapp-vite/tsconfig.app.json"
5
+ },
6
+ {
7
+ "path": "./.weapp-vite/tsconfig.server.json"
8
+ },
9
+ {
10
+ "path": "./.weapp-vite/tsconfig.node.json"
11
+ },
12
+ {
13
+ "path": "./.weapp-vite/tsconfig.shared.json"
14
+ }
15
+ ],
16
+ "files": []
17
+ }
@@ -0,0 +1,43 @@
1
+ import { defineConfig } from 'weapp-vite'
2
+
3
+ export default defineConfig({
4
+ weapp: {
5
+ srcRoot: 'src',
6
+ multiPlatform: {
7
+ enabled: true,
8
+ targets: ['weapp', 'alipay', 'tt', 'swan', 'jd', 'xhs'],
9
+ },
10
+ injectWeapi: {
11
+ enabled: true,
12
+ replaceWx: true,
13
+ },
14
+ web: {
15
+ enable: true,
16
+ outDir: 'dist/web',
17
+ pluginOptions: {
18
+ runtime: {
19
+ routing: {
20
+ mode: 'history',
21
+ },
22
+ },
23
+ },
24
+ },
25
+ generate: {
26
+ extensions: {
27
+ js: 'ts',
28
+ wxss: 'scss',
29
+ },
30
+ dirs: {
31
+ component: 'src/components',
32
+ page: 'src/pages',
33
+ },
34
+ },
35
+ },
36
+ css: {
37
+ preprocessorOptions: {
38
+ scss: {
39
+ silenceDeprecations: ['legacy-js-api', 'import'],
40
+ },
41
+ },
42
+ },
43
+ })
@@ -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,43 @@
1
+ # weapp-vite 多平台 Vue SFC + Web 模板
2
+
3
+ 这个模板使用 Wevu 和 Vue SFC 编写 App、Page 与 Component,并按命令选择单个目标平台构建。当前覆盖微信、支付宝、抖音、百度、京东、小红书和 Web Runtime。
4
+
5
+ ```sh
6
+ pnpm create weapp-vite my-app multi-platform-sfc
7
+ cd my-app
8
+ pnpm install
9
+ pnpm dev:weapp
10
+ ```
11
+
12
+ ## 开发与构建
13
+
14
+ ```sh
15
+ pnpm dev:weapp
16
+ pnpm dev:alipay
17
+ pnpm dev:tt
18
+ pnpm dev:swan
19
+ pnpm dev:jd
20
+ pnpm dev:xhs
21
+ pnpm dev:web
22
+
23
+ pnpm build:weapp
24
+ pnpm build:alipay
25
+ pnpm build:tt
26
+ pnpm build:swan
27
+ pnpm build:jd
28
+ pnpm build:xhs
29
+ pnpm build:web
30
+ ```
31
+
32
+ 每条命令只构建一个目标。小程序产物位于 `dist/<platform>/dist`,对应的 IDE 项目位于 `dist/<platform>`;Web 产物位于 `dist/web`。
33
+
34
+ ## SFC 约束
35
+
36
+ - Runtime API 从 `wevu` 导入,页面和组件默认使用 `<script setup lang="ts">`。
37
+ - App、Page、Component 分别使用 `defineAppJson`、`definePageJson`、`defineComponentJson`,一个 SFC 不混用多套 JSON 配置。
38
+ - 公共模板使用显式 props 与事件,不使用 `v-bind="object"`、不可赋值的 `v-model` 或仅适用于 Vue Web 的模板行为。
39
+ - `.weapp-vite` 是 `wv prepare` 管理的类型支持目录;类型漂移时先运行 `pnpm exec wv prepare -p weapp`。
40
+
41
+ 各平台项目配置位于 `config/<platform>`。创建项目后请替换目标平台的 AppID,再导入对应的 `dist/<platform>` 目录。
42
+
43
+ Web Runtime 适合浏览器联调和兼容验证,不能替代小程序开发者工具或真机验收。微信和 Web 可以做自动化交互验收,支付宝使用官方 `minidev build` 做 IDE 编译检查,百度 Runtime 依赖可用的 WebSocket 端点,抖音、京东和小红书仍需在各自官方工具中人工复验。详细说明见 [多平台构建指南](https://vite.icebreaker.top/guide/multi-platform)。
@@ -0,0 +1,8 @@
1
+ {
2
+ "format": 2,
3
+ "compileType": "mini",
4
+ "miniprogramRoot": "dist",
5
+ "compileOptions": {
6
+ "typescript": false
7
+ }
8
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "appid": "your_appid",
3
+ "miniprogramRoot": "dist"
4
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "smartProgramRoot": "dist",
3
+ "appid": "your_appid",
4
+ "compileType": "miniprogram",
5
+ "setting": {
6
+ "urlCheck": true
7
+ }
8
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "appid": "your_appid",
3
+ "projectname": "weapp-vite-multi-platform-sfc-template",
4
+ "miniprogramRoot": "dist",
5
+ "setting": {
6
+ "es6": true,
7
+ "urlCheck": false,
8
+ "compileHotReLoad": false
9
+ }
10
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "description": "weapp-vite 多平台 SFC 模板",
3
+ "miniprogramRoot": "dist",
4
+ "srcMiniprogramRoot": "dist",
5
+ "compileType": "miniprogram",
6
+ "setting": {
7
+ "babelSetting": {
8
+ "ignore": [],
9
+ "disablePlugins": [],
10
+ "outputPath": ""
11
+ },
12
+ "postcss": false,
13
+ "minified": false,
14
+ "ignoreUploadUnusedFiles": true,
15
+ "compileHotReLoad": false,
16
+ "packNpmManually": true,
17
+ "es6": true
18
+ },
19
+ "simulatorType": "wechat",
20
+ "libVersion": "3.13.2",
21
+ "condition": {},
22
+ "appid": "wxb3d842a4a7e3440d"
23
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "description": "weapp-vite 多平台 SFC 模板",
3
+ "miniprogramRoot": "dist",
4
+ "compileType": "miniprogram",
5
+ "setting": {
6
+ "es6": true,
7
+ "compileHotReload": false
8
+ },
9
+ "appid": "your_appid"
10
+ }
@@ -0,0 +1,7 @@
1
+ import { icebreaker } from '@icebreakers/eslint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ vue: true,
6
+ ignores: ['CHANGELOG.md', 'README.md', '.turbo/**', 'dist/**', '.weapp-vite/**'],
7
+ })
@@ -0,0 +1,30 @@
1
+ # dependencies
2
+ node_modules
3
+ .pnp
4
+ .pnp.js
5
+
6
+ # testing
7
+ coverage
8
+
9
+ # misc
10
+ .DS_Store
11
+ *.pem
12
+
13
+ # debug
14
+ npm-debug.log*
15
+ yarn-debug.log*
16
+ yarn-error.log*
17
+ .pnpm-debug.log*
18
+
19
+ # local env files
20
+ .env.local
21
+ .env.development.local
22
+ .env.test.local
23
+ .env.production.local
24
+
25
+ # turbo
26
+ .turbo
27
+
28
+ dist
29
+ vite.config.ts.timestamp-*.mjs
30
+ .weapp-vite/
@@ -0,0 +1,13 @@
1
+ <!doctype html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <link rel="icon" href="data:," />
7
+ <title>weapp-vite 多平台 SFC 模板</title>
8
+ </head>
9
+ <body>
10
+ <div id="app"></div>
11
+ <script type="module" src="/@weapp-vite/web/entry"></script>
12
+ </body>
13
+ </html>
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "weapp-vite-multi-platform-sfc-template",
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "private": true,
6
+ "description": "weapp-vite + Wevu 多平台 Vue SFC 与 Web 模板",
7
+ "license": "MIT",
8
+ "scripts": {
9
+ "dev": "wv dev -p weapp",
10
+ "dev:weapp": "wv dev -p weapp",
11
+ "dev:alipay": "wv dev -p alipay",
12
+ "dev:tt": "wv dev -p tt",
13
+ "dev:swan": "wv dev -p swan",
14
+ "dev:jd": "wv dev -p jd",
15
+ "dev:xhs": "wv dev -p xhs",
16
+ "dev:web": "wv dev -p web --host",
17
+ "dev:open": "wv dev -p weapp -o",
18
+ "build": "wv build -p weapp",
19
+ "build:weapp": "wv build -p weapp",
20
+ "build:alipay": "wv build -p alipay",
21
+ "build:tt": "wv build -p tt",
22
+ "build:swan": "wv build -p swan",
23
+ "build:jd": "wv build -p jd",
24
+ "build:xhs": "wv build -p xhs",
25
+ "build:web": "wv build -p web",
26
+ "open:weapp": "wv open -p weapp",
27
+ "open:alipay": "wv open -p alipay",
28
+ "typecheck": "vue-tsc --noEmit -p .weapp-vite/tsconfig.app.json",
29
+ "lint": "eslint .",
30
+ "lint:fix": "eslint . --fix",
31
+ "stylelint": "stylelint \"src/**/*.{css,scss,vue,wxss}\" --allow-empty-input",
32
+ "stylelint:fix": "stylelint \"src/**/*.{css,scss,vue,wxss}\" --fix --allow-empty-input",
33
+ "postinstall": "wv prepare -p weapp"
34
+ },
35
+ "devDependencies": {
36
+ "@icebreakers/eslint-config": "catalog:",
37
+ "@icebreakers/stylelint-config": "catalog:",
38
+ "@types/node": "catalog:",
39
+ "@weapp-vite/dashboard": "workspace:*",
40
+ "eslint": "catalog:",
41
+ "miniprogram-api-typings": "catalog:",
42
+ "stylelint": "catalog:",
43
+ "typescript": "catalog:",
44
+ "vue-tsc": "catalog:",
45
+ "weapp-vite": "workspace:*",
46
+ "wevu": "workspace:*"
47
+ }
48
+ }
@@ -0,0 +1,19 @@
1
+ <script setup lang="ts">
2
+ defineAppJson({
3
+ pages: ['pages/index/index'],
4
+ window: {
5
+ navigationBarTitleText: '多平台 SFC 模板',
6
+ navigationBarBackgroundColor: '#ffffff',
7
+ navigationBarTextStyle: 'black',
8
+ },
9
+ sitemapLocation: 'sitemap.json',
10
+ })
11
+ </script>
12
+
13
+ <style>
14
+ page {
15
+ min-height: 100%;
16
+ color: #17212b;
17
+ background: #f4f6f8;
18
+ }
19
+ </style>
@@ -0,0 +1,55 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'wevu'
3
+
4
+ const props = defineProps<{
5
+ platform?: string
6
+ }>()
7
+
8
+ defineComponentJson({
9
+ component: true,
10
+ })
11
+
12
+ const platformLabel = computed(() => props.platform || 'unknown')
13
+ </script>
14
+
15
+ <template>
16
+ <view id="platform-card" class="platform-card">
17
+ <view class="platform-card__label">
18
+ 当前 SFC 构建目标
19
+ </view>
20
+ <view id="component-platform" class="platform-card__value">
21
+ {{ platformLabel }}
22
+ </view>
23
+ <view class="platform-card__hint">
24
+ Page 与 Component 都由 Vue SFC 编译为目标平台产物
25
+ </view>
26
+ </view>
27
+ </template>
28
+
29
+ <style>
30
+ .platform-card {
31
+ padding: 32rpx;
32
+ background: #fff;
33
+ border: 2rpx solid #d8dee4;
34
+ border-radius: 12rpx;
35
+ }
36
+
37
+ .platform-card__label {
38
+ font-size: 24rpx;
39
+ color: #66717d;
40
+ }
41
+
42
+ .platform-card__value {
43
+ margin-top: 10rpx;
44
+ font-size: 44rpx;
45
+ font-weight: 700;
46
+ color: #0969da;
47
+ }
48
+
49
+ .platform-card__hint {
50
+ margin-top: 18rpx;
51
+ font-size: 26rpx;
52
+ line-height: 1.6;
53
+ color: #3d4852;
54
+ }
55
+ </style>
@@ -0,0 +1,134 @@
1
+ <script setup lang="ts">
2
+ import { computed, ref } from 'wevu'
3
+ import PlatformCard from '../../components/PlatformCard/index.vue'
4
+
5
+ definePageJson({
6
+ navigationBarTitleText: '多平台 SFC 模板',
7
+ })
8
+
9
+ const platform = import.meta.env.PLATFORM
10
+ const status = ref('ready')
11
+ const count = ref(0)
12
+ const doubled = computed(() => count.value * 2)
13
+
14
+ function increment() {
15
+ count.value += 1
16
+ }
17
+ </script>
18
+
19
+ <template>
20
+ <view class="page-shell">
21
+ <view class="page-heading">
22
+ <view class="page-heading__eyebrow">
23
+ weapp-vite + wevu
24
+ </view>
25
+ <view class="page-heading__title">
26
+ Vue SFC 多平台 + Web
27
+ </view>
28
+ <view class="page-heading__description">
29
+ 同一份 SFC 源码,按目标平台独立构建和验收。
30
+ </view>
31
+ </view>
32
+
33
+ <view id="platform-marker" class="runtime-marker">
34
+ MP_PLATFORM={{ platform }}
35
+ </view>
36
+ <view id="runtime-status" class="runtime-status">
37
+ status={{ status }}
38
+ </view>
39
+
40
+ <PlatformCard :platform="platform" />
41
+
42
+ <view class="counter-panel">
43
+ <view class="counter-panel__label">
44
+ SFC 响应式交互检查
45
+ </view>
46
+ <view id="counter-value" class="counter-panel__value">
47
+ {{ count }}
48
+ </view>
49
+ <view id="counter-doubled" class="counter-panel__doubled">
50
+ doubled={{ doubled }}
51
+ </view>
52
+ <button id="increment-button" class="counter-panel__button" @tap="increment">
53
+ 增加计数
54
+ </button>
55
+ </view>
56
+ </view>
57
+ </template>
58
+
59
+ <style>
60
+ .page-shell {
61
+ box-sizing: border-box;
62
+ min-height: 100vh;
63
+ padding: 72rpx 32rpx 48rpx;
64
+ }
65
+
66
+ .page-heading {
67
+ margin-bottom: 32rpx;
68
+ }
69
+
70
+ .page-heading__eyebrow {
71
+ font-size: 24rpx;
72
+ font-weight: 600;
73
+ color: #1a7f37;
74
+ }
75
+
76
+ .page-heading__title {
77
+ margin-top: 12rpx;
78
+ font-size: 52rpx;
79
+ font-weight: 700;
80
+ color: #17212b;
81
+ }
82
+
83
+ .page-heading__description {
84
+ margin-top: 16rpx;
85
+ font-size: 28rpx;
86
+ line-height: 1.6;
87
+ color: #57606a;
88
+ }
89
+
90
+ .runtime-marker,
91
+ .runtime-status {
92
+ font-family: monospace;
93
+ font-size: 24rpx;
94
+ color: #57606a;
95
+ }
96
+
97
+ .runtime-status {
98
+ margin: 8rpx 0 28rpx;
99
+ }
100
+
101
+ .counter-panel {
102
+ padding: 32rpx;
103
+ margin-top: 24rpx;
104
+ text-align: center;
105
+ background: #fff;
106
+ border: 2rpx solid #d8dee4;
107
+ border-radius: 12rpx;
108
+ }
109
+
110
+ .counter-panel__label,
111
+ .counter-panel__doubled {
112
+ font-size: 26rpx;
113
+ color: #57606a;
114
+ }
115
+
116
+ .counter-panel__value {
117
+ margin: 18rpx 0 8rpx;
118
+ font-size: 64rpx;
119
+ font-weight: 700;
120
+ color: #17212b;
121
+ }
122
+
123
+ .counter-panel__button {
124
+ width: 100%;
125
+ margin-top: 24rpx;
126
+ color: #fff;
127
+ background: #1f883d;
128
+ border-radius: 8rpx;
129
+ }
130
+
131
+ .counter-panel__button::after {
132
+ border: 0;
133
+ }
134
+ </style>
@@ -0,0 +1,9 @@
1
+ {
2
+ "desc": "多平台 SFC 模板 sitemap",
3
+ "rules": [
4
+ {
5
+ "action": "allow",
6
+ "page": "*"
7
+ }
8
+ ]
9
+ }
@@ -0,0 +1,5 @@
1
+ import { icebreaker } from '@icebreakers/stylelint-config'
2
+
3
+ export default icebreaker({
4
+ miniProgram: true,
5
+ })
@@ -0,0 +1,17 @@
1
+ {
2
+ "references": [
3
+ {
4
+ "path": "./.weapp-vite/tsconfig.app.json"
5
+ },
6
+ {
7
+ "path": "./.weapp-vite/tsconfig.server.json"
8
+ },
9
+ {
10
+ "path": "./.weapp-vite/tsconfig.node.json"
11
+ },
12
+ {
13
+ "path": "./.weapp-vite/tsconfig.shared.json"
14
+ }
15
+ ],
16
+ "files": []
17
+ }
@@ -0,0 +1,26 @@
1
+ import { defineConfig } from 'weapp-vite'
2
+
3
+ export default defineConfig({
4
+ weapp: {
5
+ srcRoot: 'src',
6
+ multiPlatform: {
7
+ enabled: true,
8
+ targets: ['weapp', 'alipay', 'tt', 'swan', 'jd', 'xhs'],
9
+ },
10
+ injectWeapi: {
11
+ enabled: true,
12
+ replaceWx: true,
13
+ },
14
+ web: {
15
+ enable: true,
16
+ outDir: 'dist/web',
17
+ pluginOptions: {
18
+ runtime: {
19
+ routing: {
20
+ mode: 'history',
21
+ },
22
+ },
23
+ },
24
+ },
25
+ },
26
+ })