当前位置:网站首页>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"
},
边栏推荐
猜你喜欢

DRM display framework as I understand it

Go language web development is very simple: use templates to separate views from logic

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

软件测试答疑篇

Test case

File contains vulnerabilities (II)

Alibaba: open source and self-developed liquid cooling data center technology

Thunder on the ground! Another domestic 5g chip comes out: surpass Huawei and lead the world in performance?

Spark概述

Unity shader learning notes (3) URP rendering pipeline shaded PBR shader template (ASE optimized version)
随机推荐
使用HBuilderX的一些常用功能
RGB 无限立方体(高级版)
Software testing - concept
Spark概述
PHP parent
PHP inner class name is the same as the inner class method name
Vite打包后的dist不能直接在浏览器打开吗
Go 学习笔记整合
How to write good code - Defensive Programming Guide
正则表达式总结
STC8H8K系列汇编和C51实战——串口发送菜单界面选择不同功能
Unity Shader 学习笔记(3)URP渲染管线带阴影PBR-Shader模板(ASE优化版本)
【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
TI毫米波雷达学习(一)
Lambda expressions and method references
ROS2----LifecycleNode生命周期节点总结
CNN可视化技术 -- CAM & Grad-CAM详解及pytorch简洁实现
Cambrian was reduced by Paleozoic venture capital and Zhike shengxun: a total of more than 700million cash
Fundamentals of software testing
1035 Password