当前位置:网站首页>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"
},
边栏推荐
- Grbl software: basic knowledge of simple explanation
- uni-app开发中遇到的问题(持续更新)
- 神机百炼3.54-染色法判定二分图
- 软件测试 - 概念篇
- Stc8h8k series assembly and C51 actual combat - digital display ADC, key serial port reply key number and ADC value
- 如何使用MITMPROXy
- 5g market trend in 2020
- 神机百炼3.53-Kruskal
- 深度学习分类网络--VGGNet
- Regular expression summary
猜你喜欢
随机推荐
【C语言】简单实现扫雷游戏
数据挖掘方向研究生常用网站
ROS2----LifecycleNode生命周期节点总结
Matplotlib double Y axis + adjust legend position
神机百炼3.53-Kruskal
ES6的详细注解
[PHP是否安装了 SOAP 扩]对于php实现soap代理的一个常见问题:Class ‘SoapClient‘ not found in PHP的处理方法
Unity shader learning notes (3) URP rendering pipeline shaded PBR shader template (ASE optimized version)
MUI底部导航的样式修改
1036 Boys vs Girls
Fundamentals of software testing
3D 打印机 G 代码命令:完整列表和教程
Reading notes of cgnf: conditional graph neural fields
PHP parent
数理统计与机器学习
[C language] simple implementation of mine sweeping game
1035 Password
【论文翻译】GCNet: Non-local Networks Meet Squeeze-Excitation Networks and Beyond
php按照指定字符,获取字符串中的部分值,并重组剩余字符串为新的数组
页面打印插件print.js