时间:2021-07-01 10:21:17 帮助过:7人阅读
1.mint-ui
安装:
- npm install mint-ui --save
使用:
main.js
- // MintUI组件库
- import MintUI from 'mint-ui'
- import 'mint-ui/lib/style.css'
- Vue.use(MintUI)
2.vux
安装:
- npm install vux --save
- npm install vux-loader --save
使用:
vux2必须配合vux-loader使用, 请在build/webpack.base.conf.js里参照如下代码进行配置:
- build / webpack.base.conf.js
- const vuxLoader = require('vux-loader')
- const webpackConfig = originalConfig // 原来的 module.exports 代码赋值给变量 webpackConfig
- module.exports = vuxLoader.merge(webpackConfig, {
- plugins: ['vux-ui']
- })
实例:webpack.base.conf.js
- 'use strict'
- const path = require('path')
- const utils = require('./utils')
- const config = require('../config')
- const vueLoaderConfig = require('./vue-loader.conf')
- // 添加 vux-loader
- const vuxLoader = require('vux-loader')
- function resolve (dir) {
- return path.join(__dirname, '..', dir)
- }
- // 原来的 module.exports 代码赋值给变量 webpackConfig
- const webpackConfig = {
- entry: {
- app: './src/main.js'
- },
- output: {
- path: config.build.assetsRoot,
- filename: '[name].js',
- publicPath: process.env.NODE_ENV === 'production'
- ? config.build.assetsPublicPath
- : config.dev.assetsPublicPath
- },
- resolve: {
- extensions: ['.js', '.vue', '.json'],
- alias: {
- 'vue$': 'vue/dist/vue.esm.js',
- '@': resolve('src'),
- }
- },
- module: {
- rules: [
- {
- test: /\.vue$/,
- loader: 'vue-loader',
- options: vueLoaderConfig
- },
- {
- test: /\.js$/,
- loader: 'babel-loader',
- include: [resolve('src'), resolve('test')]
- },
- {
- test: /\.(png|jpe?g|gif|svg)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('img/[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('media/[name].[hash:7].[ext]')
- }
- },
- {
- test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
- loader: 'url-loader',
- options: {
- limit: 10000,
- name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
- }
- }
- ]
- }
- }
- // 扩展
- module.exports = vuxLoader.merge(webpackConfig, {
- plugins: ['vux-ui']
- })
3.weex-ui
安装:
- npm install weex-ui --save
使用:
为了不打包所有的组件,你需要使用 babel-plugin-component 来只引入需要的组件打包。
- npm i babel-plugin-component -D
.babelrc
- // 增加一个plugins的配置到 .babelrc 中
- {
- "plugins": [
- [
- "component",
- {
- "libraryName": "weex-ui",
- "libDir": "packages"
- }
- ]
- ]
- }
上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:
使用javascript如何实现数字配对游戏
在vue.js中如何调用vuex储存接口数据
在JavaScript中如何实现全选取消效果
使用JavaScript如何实现左侧菜单效果
以上就是在vue2.0中有哪些常用的 UI 库?的详细内容,更多请关注Gxl网其它相关文章!