当前位置:网站首页>Introduce uview into uni app
Introduce uview into uni app
2022-07-02 05:59:00 【Serena_ tz】
stay uni-app Introduction in uView There are two ways :
adopt npm download
// If your root directory does not package.json Word of the file , Please execute the following command first :
// npm init -y
npm install uview-ui
// to update
// npm update uview-ui
Configuration steps
1. introduce uView Lord JS library
In the project root directory main.js in , Introduce and use uView Of JS library , Note that these two lines should be placed in import Vue after .
// main.js
// IMPORT Global uView frame
import uView from 'uview-ui';
Vue.use(uView);
2. In the introduction of uView Overall situation SCSS topic file
At the root of the project uni.scss To introduce this file .
/* uni.scss introduce view The theme style */
@import 'uview-ui/theme.scss';
3. introduce uView Basic style
Be careful : stay App.vue The position of the first line in the... Is introduced , Pay attention to style Label to join lang="scss" attribute
<style lang="scss">
/* Pay attention to the first line , At the same time style Label to join lang="scss" attribute */
@import "uview-ui/index.scss";
</style>
4. To configure easycom Component mode
stay pages.json To configure ,uni-app For performance reasons , modify easycom The rules will not take effect in real time , After the configuration , You need to restart Hbuilder X Or recompile the project to work properly uView The function of . Please make sure your pages.json Only one of them easycom Field , Otherwise, please merge multiple import rules by yourself .
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
Install through the plug-in market
If you use Hbuilder X Development , You can go to uni-app Plug in market adopt uni_modules Install in the form of .
1. Click Import 
2. open hbuilderX
3. Select project 
4. Start the download 
5. Make sure that... Is installed scss/sass compiler
Found in tool “ Plug in installation ”

Configuration steps
1. introduce uView Lord JS library
In the project root directory main.js in , Introduce and use uView Of JS library , Note that these two lines should be placed in import Vue after .
// main.js
import uView from '@/uni_modules/uview-ui'
Vue.use(uView
2. In the introduction of uView Overall situation SCSS topic file
At the root of the project uni.scss To introduce this file .
/* uni.scss */
@import '@/uni_modules/uview-ui/theme.scss';
3. introduce uView Basic style
Be careful : stay App.vue The position of the first line in the... Is introduced , Pay attention to style Label to join lang="scss" attribute
<style lang="scss">
/* Pay attention to the first line , At the same time style Label to join lang="scss" attribute */
@import "@/uni_modules/uview-ui/index.scss";
</style>
4. To configure easycom Component mode
stay pages.json To configure ,uni-app For performance reasons , modify easycom The rules will not take effect in real time , After the configuration , You need to restart Hbuilder X Or recompile the project to work properly uView The function of . Please make sure your pages.json Only one of them easycom Field , Otherwise, please merge multiple import rules by yourself .uni_modules Way to introduce uview You can not configure .
"easycom": {
"^u-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue"
},
边栏推荐
- RGB infinite cube (advanced version)
- [PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
- Go language web development is very simple: use templates to separate views from logic
- 500. 键盘行
- Linkage between esp8266 and stc8h8k single chip microcomputer - Weather Clock
- Test case
- 软件测试基础篇
- Page printing plug-in print js
- JWT工具类
- File contains vulnerabilities (II)
猜你喜欢
随机推荐
495.提莫攻击
[C language] screening method for prime numbers
Redis key value database [primary]
all3dp.com网站中全部Arduino项目(2022.7.1)
Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash
1036 Boys vs Girls
php父类(parent)
Oled12864 LCD screen
Stc8h8k series assembly and C51 actual combat - serial port sending menu interface to select different functions
php继承(extends)
PHP gets CPU usage, hard disk usage, and memory usage
PHP development and testing WebService (soap) -win
数据库学习总结5
格式校验js
Practice C language advanced address book design
Alibaba: open source and self-developed liquid cooling data center technology
[PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
如何使用MITMPROXy
Verifying downloaded files using sha256 files
Stc8h8k Series Assembly and c51 Real combat - NIXIE TUBE displays ADC, Key Series port reply Key number and ADC value









