create-weapp-vite 2.7.3 → 2.8.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.
- package/README.md +14 -1
- package/dist/cli.js +9 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/{src-oq4dsVyY.js → src-DLBjE7f9.js} +45 -27
- package/package.json +4 -4
- package/templates/multi-platform/.editorconfig +9 -0
- package/templates/multi-platform/README.md +46 -0
- package/templates/multi-platform/config/alipay/mini.project.json +8 -0
- package/templates/multi-platform/config/jd/project.config.json +4 -0
- package/templates/multi-platform/config/swan/project.swan.json +8 -0
- package/templates/multi-platform/config/tt/project.config.json +10 -0
- package/templates/multi-platform/config/weapp/project.config.json +24 -0
- package/templates/multi-platform/config/xhs/project.config.json +10 -0
- package/templates/multi-platform/eslint.config.js +6 -0
- package/templates/multi-platform/gitignore +30 -0
- package/templates/multi-platform/index.html +13 -0
- package/templates/multi-platform/package.json +47 -0
- package/templates/multi-platform/src/app.json +13 -0
- package/templates/multi-platform/src/app.scss +5 -0
- package/templates/multi-platform/src/app.ts +3 -0
- package/templates/multi-platform/src/components/PlatformCard/index.json +5 -0
- package/templates/multi-platform/src/components/PlatformCard/index.scss +25 -0
- package/templates/multi-platform/src/components/PlatformCard/index.ts +8 -0
- package/templates/multi-platform/src/components/PlatformCard/index.wxml +5 -0
- package/templates/multi-platform/src/pages/index/index.json +7 -0
- package/templates/multi-platform/src/pages/index/index.scss +72 -0
- package/templates/multi-platform/src/pages/index/index.ts +12 -0
- package/templates/multi-platform/src/pages/index/index.wxml +22 -0
- package/templates/multi-platform/src/pages/index/platform.wxs +7 -0
- package/templates/multi-platform/src/sitemap.json +9 -0
- package/templates/multi-platform/stylelint.config.js +5 -0
- package/templates/multi-platform/tsconfig.json +17 -0
- package/templates/multi-platform/vite.config.ts +43 -0
- package/templates/multi-platform-sfc/.editorconfig +9 -0
- package/templates/multi-platform-sfc/README.md +43 -0
- package/templates/multi-platform-sfc/config/alipay/mini.project.json +8 -0
- package/templates/multi-platform-sfc/config/jd/project.config.json +4 -0
- package/templates/multi-platform-sfc/config/swan/project.swan.json +8 -0
- package/templates/multi-platform-sfc/config/tt/project.config.json +10 -0
- package/templates/multi-platform-sfc/config/weapp/project.config.json +24 -0
- package/templates/multi-platform-sfc/config/xhs/project.config.json +10 -0
- package/templates/multi-platform-sfc/eslint.config.js +7 -0
- package/templates/multi-platform-sfc/gitignore +30 -0
- package/templates/multi-platform-sfc/index.html +13 -0
- package/templates/multi-platform-sfc/package.json +48 -0
- package/templates/multi-platform-sfc/src/app.vue +19 -0
- package/templates/multi-platform-sfc/src/components/PlatformCard/index.vue +55 -0
- package/templates/multi-platform-sfc/src/pages/index/index.vue +134 -0
- package/templates/multi-platform-sfc/src/sitemap.json +9 -0
- package/templates/multi-platform-sfc/stylelint.config.js +5 -0
- package/templates/multi-platform-sfc/tsconfig.json +17 -0
- package/templates/multi-platform-sfc/vite.config.ts +26 -0
- package/templates/react/package.json +1 -1
|
@@ -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,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,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,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,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "weapp-vite 多平台 SFC 模板",
|
|
3
|
+
"miniprogramRoot": "dist",
|
|
4
|
+
"srcMiniprogramRoot": "dist",
|
|
5
|
+
"compileType": "miniprogram",
|
|
6
|
+
"setting": {
|
|
7
|
+
"urlCheck": false,
|
|
8
|
+
"babelSetting": {
|
|
9
|
+
"ignore": [],
|
|
10
|
+
"disablePlugins": [],
|
|
11
|
+
"outputPath": ""
|
|
12
|
+
},
|
|
13
|
+
"postcss": false,
|
|
14
|
+
"minified": false,
|
|
15
|
+
"ignoreUploadUnusedFiles": true,
|
|
16
|
+
"compileHotReLoad": false,
|
|
17
|
+
"packNpmManually": true,
|
|
18
|
+
"es6": true
|
|
19
|
+
},
|
|
20
|
+
"simulatorType": "wechat",
|
|
21
|
+
"libVersion": "3.13.2",
|
|
22
|
+
"condition": {},
|
|
23
|
+
"appid": "wxb3d842a4a7e3440d"
|
|
24
|
+
}
|
|
@@ -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,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
|
+
}
|