当前位置:网站首页>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"
},
边栏推荐
- Mathematical statistics and machine learning
- Some experience of exercise and fitness
- Unity Shader 学习笔记(3)URP渲染管线带阴影PBR-Shader模板(ASE优化版本)
- Keepalived installation, use and quick start
- 数据回放伴侣Rviz+plotjuggler
- 51 single chip microcomputer - ADC explanation (a/d conversion, d/a conversion)
- Spark概述
- [leetcode] day92 container with the most water
- php读文件(读取json文件,转换为数组)
- Summary of MySQL constraints
猜你喜欢

Matplotlib double Y axis + adjust legend position

经典文献阅读之--SuMa++

软件测试 - 概念篇

在uni-app中引入uView

PHP development and testing WebService (soap) -win

神机百炼3.52-Prim

Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash

Ti millimeter wave radar learning (I)

Stick to the big screen UI, finereport development diary

RGB 无限立方体(高级版)
随机推荐
Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash
servlet的web.xml配置详解(3.0)
【LeetCode】Day92-盛最多水的容器
Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?
RGB infinite cube (advanced version)
php内的addChild()、addAttribute()函数
Lambda expressions and method references
1036 Boys vs Girls
php读文件(读取json文件,转换为数组)
Eco express micro engine system has supported one click deployment to cloud hosting
文件包含漏洞(二)
Redis key value database [seckill]
Test case
“簡單”的無限魔方
Software testing - concept
Some descriptions of Mipi protocol of LCD
[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP
PHP gets CPU usage, hard disk usage, and memory usage
软件测试答疑篇
PHP array to XML