当前位置:网站首页>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"
},
边栏推荐
- mock-用mockjs模拟后台返回数据
- mysql事务和隔离级别
- Redis key value database [seckill]
- [paper translation] gcnet: non local networks meet squeeze exception networks and beyond
- Brain and cognitive neuroscience matlab psychoolbox cognitive science experimental design - experimental design 4
- Unity shader learning notes (3) URP rendering pipeline shaded PBR shader template (ASE optimized version)
- STC8H8K系列汇编和C51实战——数码管显示ADC、按键串口回复按键号与ADC数值
- js判断移动端还是pc端
- Web页面用户分步操作引导插件driver.js
- Page printing plug-in print js
猜你喜欢

Zabbix Server trapper 命令注入漏洞 (CVE-2017-2824)

Fundamentals of software testing

《CGNF: CONDITIONAL GRAPH NEURAL FIELDS》阅读笔记

PHP 开发与测试 Webservice(SOAP)-Win

File contains vulnerability (I)

深度学习分类网络--VGGNet

uni-app开发中遇到的问题(持续更新)

软件测试基础篇
![[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP](/img/25/73f11ab2711ed2cc9f20bc7f9116b6.png)
[whether PHP has soap extensions installed] a common problem for PHP to implement soap proxy: how to handle class' SoapClient 'not found in PHP

Eco express micro engine system has supported one click deployment to cloud hosting
随机推荐
Stc8h8k Series Assembly and c51 Real combat - NIXIE TUBE displays ADC, Key Series port reply Key number and ADC value
Memcached installation
Keepalived installation, use and quick start
Generics and generic constraints of typescript
PHP inner class name is the same as the inner class method name
Reading notes of cgnf: conditional graph neural fields
51单片机——ADC讲解(A/D转换、D/A转换)
Huawei Hongmeng OS, is it OK?
Lambda expressions and method references
External interrupts cannot be accessed. Just delete the code and restore it Record this unexpected bug
15 C language advanced dynamic memory management
深度学习分类网络 -- AlexNet
软件测试答疑篇
PHP read file (read JSON file, convert to array)
OLED12864 液晶屏
图片裁剪插件cropper.js
Vite打包后的dist不能直接在浏览器打开吗
Go learning notes integration
Yyds dry inventory what is test driven development
死磕大屏UI,FineReport开发日记