uniapp中引入uView
"version": "2.0.29"
main.js(根目录下)
// 引入uView
import uView from 'uview-ui'
Vue.use(uView)
// uni.$u.config.unit = 'rpx' // 不配的情况下默认单位px
uni.scss (根目录下)
// 第一行 引入uView
@import 'uview-ui/theme.scss';
App.vue(src目录下, lang='scss’一定要加)
<style lang="scss">
// uView
@import "uview-ui/index.scss";
</style>
pages.json(根目录下,与“pages”配置同级)
// uview
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
test.vue
<u-button type="primary" text="确定">确定</u-button>