diff --git a/package-lock.json b/package-lock.json
index adffa00..bf26fb9 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -24,6 +24,9 @@
"@dcloudio/uni-mp-weixin": "3.0.0-5020420260813003",
"@dcloudio/uni-mp-xhs": "3.0.0-5020420260813003",
"@dcloudio/uni-quickapp-webview": "3.0.0-5020420260813003",
+ "clipboard": "^2.0.11",
+ "dayjs": "^1.11.23",
+ "uview-plus": "^3.8.125",
"vue": "^3.4.21",
"vue-i18n": "^9.1.9"
},
@@ -35,6 +38,7 @@
"@dcloudio/vite-plugin-uni": "3.0.0-5020420260813003",
"@vue/runtime-core": "^3.4.21",
"@vue/tsconfig": "^0.1.3",
+ "sass": "^1.63.2",
"typescript": "^4.9.4",
"vite": "5.2.8",
"vue-tsc": "^1.0.24"
@@ -6524,6 +6528,17 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/clipboard": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/clipboard/-/clipboard-2.0.11.tgz",
+ "integrity": "sha512-C+0bbOqkezLIsmWSvlsXS0Q0bmkugu7jcfMIACB+RDEntIzQIkdr148we28AfSloQLRdZlYL/QYyrq05j/3Faw==",
+ "license": "MIT",
+ "dependencies": {
+ "good-listener": "^1.2.2",
+ "select": "^1.1.2",
+ "tiny-emitter": "^2.0.0"
+ }
+ },
"node_modules/cliui": {
"version": "7.0.4",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
@@ -6836,6 +6851,12 @@
"node": ">=10"
}
},
+ "node_modules/dayjs": {
+ "version": "1.11.23",
+ "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.23.tgz",
+ "integrity": "sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==",
+ "license": "MIT"
+ },
"node_modules/de-indent": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz",
@@ -6907,6 +6928,12 @@
"node": ">=0.4.0"
}
},
+ "node_modules/delegate": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/delegate/-/delegate-3.2.0.tgz",
+ "integrity": "sha512-IofjkYBZaZivn0V8nnsMJGBr4jVLxHDheKSW88PyxS5QC4Vo9ZbZVvhzlSxY87fVq3STR6r+4cGepyHkcWOQSw==",
+ "license": "MIT"
+ },
"node_modules/depd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
@@ -7738,6 +7765,15 @@
"process": "^0.11.10"
}
},
+ "node_modules/good-listener": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/good-listener/-/good-listener-1.2.2.tgz",
+ "integrity": "sha512-goW1b+d9q/HIwbVYZzZ6SsTr4IgE+WA44A0GmPIQstuOrgsFcT7VEJ48nmr9GaRtNu0XTKacFLGnBPAM6Afouw==",
+ "license": "MIT",
+ "dependencies": {
+ "delegate": "^3.1.2"
+ }
+ },
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
@@ -7950,6 +7986,13 @@
],
"license": "BSD-3-Clause"
},
+ "node_modules/immutable": {
+ "version": "4.3.9",
+ "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.3.9.tgz",
+ "integrity": "sha512-ObHy4YN7ycwZOUCLI1/6svfyAFu7vL8RhAvVu/bh/RZW9EPlOyDaQ9jDQWCtdqzaXUjgXZCW1migtHE7YI7UGQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
"node_modules/import-local": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/import-local/-/import-local-3.2.0.tgz",
@@ -11779,6 +11822,25 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/sass": {
+ "version": "1.63.2",
+ "resolved": "https://registry.npmjs.org/sass/-/sass-1.63.2.tgz",
+ "integrity": "sha512-u56TU0AIFqMtauKl/OJ1AeFsXqRHkgO7nCWmHaDwfxDo9GUMSqBA4NEh6GMuh1CYVM7zuROYtZrHzPc2ixK+ww==",
+ "devOptional": true,
+ "license": "MIT",
+ "peer": true,
+ "dependencies": {
+ "chokidar": ">=3.0.0 <4.0.0",
+ "immutable": "^4.0.0",
+ "source-map-js": ">=0.6.2 <2.0.0"
+ },
+ "bin": {
+ "sass": "sass.js"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
"node_modules/sax": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz",
@@ -11807,6 +11869,12 @@
"integrity": "sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==",
"license": "MIT"
},
+ "node_modules/select": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/select/-/select-1.1.2.tgz",
+ "integrity": "sha512-OwpTSOfy6xSs1+pwcNrv0RBMOzI39Lp3qQKUTPVVPRjCdNa5JH/oPRiqsesIskK8TVgmRiHwO4KXlV2Li9dANA==",
+ "license": "MIT"
+ },
"node_modules/semver": {
"version": "6.3.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
@@ -12413,6 +12481,12 @@
"integrity": "sha512-IjZc9KIotudix8bMaBW6QvMuq64BrJWFs1+4V0lXwWGQZwH+LnX87doAYhem4caOEusRP9/g6jVDQmZ8XOk1nw==",
"license": "MIT"
},
+ "node_modules/tiny-emitter": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz",
+ "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==",
+ "license": "MIT"
+ },
"node_modules/tinycolor2": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
@@ -12834,6 +12908,16 @@
"node": ">= 0.4.0"
}
},
+ "node_modules/uview-plus": {
+ "version": "3.8.125",
+ "resolved": "https://registry.npmjs.org/uview-plus/-/uview-plus-3.8.125.tgz",
+ "integrity": "sha512-AKtqKwtMTVOjj6wZ/FbXY5NQMuV1/WJTSe7Fs83nwDlSs2VnVus4THHTVlm1D/Bbnl5Io8WWOJxd3diB8/Zg6w==",
+ "engines": {
+ "HBuilderX": "^3.1.0",
+ "uni-app": "^4.66",
+ "uni-app-x": ""
+ }
+ },
"node_modules/v8-to-istanbul": {
"version": "8.1.1",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz",
diff --git a/package.json b/package.json
index 248b25d..1d33bc0 100644
--- a/package.json
+++ b/package.json
@@ -53,6 +53,9 @@
"@dcloudio/uni-mp-weixin": "3.0.0-5020420260813003",
"@dcloudio/uni-mp-xhs": "3.0.0-5020420260813003",
"@dcloudio/uni-quickapp-webview": "3.0.0-5020420260813003",
+ "clipboard": "^2.0.11",
+ "dayjs": "^1.11.23",
+ "uview-plus": "^3.8.125",
"vue": "^3.4.21",
"vue-i18n": "^9.1.9"
},
@@ -62,8 +65,9 @@
"@dcloudio/uni-cli-shared": "3.0.0-5020420260813003",
"@dcloudio/uni-stacktracey": "3.0.0-5020420260813003",
"@dcloudio/vite-plugin-uni": "3.0.0-5020420260813003",
- "@vue/tsconfig": "^0.1.3",
"@vue/runtime-core": "^3.4.21",
+ "@vue/tsconfig": "^0.1.3",
+ "sass": "^1.63.2",
"typescript": "^4.9.4",
"vite": "5.2.8",
"vue-tsc": "^1.0.24"
diff --git a/src/App.vue b/src/App.vue
index 6086575..d82d2fa 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -10,4 +10,7 @@ onHide(() => {
console.log("App Hide");
});
-
+
diff --git a/src/main.ts b/src/main.ts
index b12c1ee..23e8ed4 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,7 +1,11 @@
import { createSSRApp } from "vue";
import App from "./App.vue";
+import uviewPlus from "uview-plus";
+
export function createApp() {
const app = createSSRApp(App);
+ // 注册 uview-plus,注册后才可使用 uni.$u 等全局工具方法
+ app.use(uviewPlus);
return {
app,
};
diff --git a/src/manifest.json b/src/manifest.json
index 309b9ec..1390bfd 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -54,7 +54,9 @@
"setting" : {
"urlCheck" : false
},
- "usingComponents" : true
+ "usingComponents" : true,
+ /* uview-plus 要求:将虚拟节点属性合并到根节点,否则组件样式可能异常 */
+ "mergeVirtualHostAttributes" : true
},
"mp-alipay" : {
"usingComponents" : true
@@ -63,7 +65,8 @@
"usingComponents" : true
},
"mp-toutiao" : {
- "usingComponents" : true
+ "usingComponents" : true,
+ "mergeVirtualHostAttributes" : true
},
"uniStatistics": {
"enable": false
diff --git a/src/pages.json b/src/pages.json
index 1aea851..61788fa 100644
--- a/src/pages.json
+++ b/src/pages.json
@@ -1,4 +1,15 @@
{
+ // easycom:uview-plus 组件按需自动引入,页面中无需手动 import
+ // 注意:修改 easycom 规则不会热更新,需重启编译才生效
+ "easycom": {
+ "autoscan": true,
+ // 规则必须写在 custom 中,否则无效
+ "custom": {
+ "^u--(.*)": "uview-plus/components/u-$1/u-$1.vue",
+ "^up-(.*)": "uview-plus/components/u-$1/u-$1.vue",
+ "^u-([^-].*)": "uview-plus/components/u-$1/u-$1.vue"
+ }
+ },
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index ecac4f5..76b10d9 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -4,15 +4,42 @@
{{ title }}
+
+
+
+
+
+
+
+
+
+
+
-
diff --git a/src/uni.scss b/src/uni.scss
index 288300d..8a116cd 100644
--- a/src/uni.scss
+++ b/src/uni.scss
@@ -73,4 +73,11 @@ $uni-font-size-title: 20px;
$uni-color-subtitle: #555; // 二级标题颜色
$uni-font-size-subtitle: 18px;
$uni-color-paragraph: #3f536e; // 文章段落颜色
-$uni-font-size-paragraph: 15px;
\ No newline at end of file
+$uni-font-size-paragraph: 15px;
+
+/* ==================== uview-plus 主题变量 ==================== */
+/* theme.scss 内的变量均使用 !default,所以必须放在本文件末尾:
+ 这样你在上方自定义的 $u-* 变量才能覆盖 uview-plus 默认主题。
+ 注意:uview-plus/index.scss 基础样式严禁写在此处,必须写在 App.vue,
+ 否则会造成打包后体积异常增大。 */
+@import 'uview-plus/theme.scss';
\ No newline at end of file
diff --git a/tsconfig.json b/tsconfig.json
index 11fffd2..dfcce72 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -7,7 +7,7 @@
"@/*": ["./src/*"]
},
"lib": ["esnext", "dom"],
- "types": ["@dcloudio/types"]
+ "types": ["@dcloudio/types", "uview-plus/types"]
},
"include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"]
}