IMPORTANT: This article is just a record of setting up the framework of this project
I. Create the UniAPP project
Vue create -p dCloudio/UNI-preset – Vue ts-uni-mini
Choose the default TypeScript
Enter the project after creating it
cd ts-uni-mini
Use inline TS in vUE files for new projects
Introduce vUE decorators as needed
import { Component,Vue ,Watch} from “vue-property-decorator”;
Whatever you do add the following sentence.
/ / must be @ Component ({})
Start project NPM run dev:mp-weixin
Open the wechat developer tool
Import the project
Select the imported project
Project started successfully
4. Introduce uView
- Install uView
npm install uview-ui
- Add a declaration to the SFC.d. ts file
declare module ‘uview-ui’
- Introduce the uView main JS library
In the project root directory main.ts, import and use uView’s JS library. Note that these two lines come after import Vue.
// main.ts import uView from “uview-ui”; Vue.use(uView);
- Global SCSS theme file in uView
Import this file in uni.scss in the project root directory. /* uni.scss */ @import ‘uview-ui/theme.scss’;
- Introduce the uView base style in app.vue
- Configure the EasyCOM component pattern
This configuration needs to be done in pages. Json in the project root directory.
Warm prompt
Uni-app For performance debugging reasons, the modification of easyCOM rules will not take effect in real time. After configuration, you need to restart HX or recompile the project to use uView functions normally.
Make sure you have only one easycom field in your pages.json, or merge the incoming rules yourself.
/ / pages. Json {” easycom “: {” ^ u – (. *)” : “uview – UI/components / / u u – 1-1 / u/u – 1-1. Vue”}}
V. Request package directory as follows
Github address: github.com/ysm27/TypeS…
Pass by point praise bai Xi xi ~