VEX的使用教程
VEX配置步骤:
1、在项目里安装vux
npm install vux --save
2、安装vux-loader
npm install vux-loader --save-dev
3、 安装less-loade
npm install less less-loader --save-dev
4、在Vue项目中的build文件夹下webpack.base.conf.js 文件进行配置

加入如下代码:
const vuxLoader = require('vux-loader')
将之前的module.exports 替换为 const webpackConfig
然后再底部加入如下代码:
module.exports = vuxLoader.merge(webpackConfig, { plugins: ['vux-ui'] })
再然后在 webpackConfig 节点下的 resolve 对象的 extensions 数组中添加less:
extensions: ['.js', '.vue', '.json','less'],
webpack.base.conf.js 代码如下:
'use strict' const path = require('path') const utils = require('./utils') const config = require('../config') const vueLoaderConfig = require('./vue-loader.conf') function resolve (dir) { return path.join(__dirname, '..', dir) } resolve const createLintingRule = () => ({ test: /\.(js|vue)$/, loader: 'eslint-loader', enforce: 'pre', include: [resolve('src'), resolve('test')], options: { formatter: require('eslint-friendly-formatter'), emitWarning: !config.dev.showEslintErrorsInOverlay } }) const vuxLoader = require('vux-loader') const webpackConfig = { context: path.resolve(__dirname, '../'), 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','less'], alias: { 'vue$': 'vue/dist/vue.esm.js', '@': resolve('src'), } }, module: { rules: [ ...(config.dev.useEslint ? [createLintingRule()] : []), { test: /\.vue$/, loader: 'vue-loader', options: vueLoaderConfig }, { test: /\.js$/, loader: 'babel-loader', include: [resolve('src'), resolve('test'), resolve('node_modules/webpack-dev-server/client')] }, { 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]') } } ] }, node: { // prevent webpack from injecting useless setImmediate polyfill because Vue // source contains it (although only uses it if it's native). setImmediate: false, // prevent webpack from injecting mocks to Node native modules // that does not make sense for the client dgram: 'empty', fs: 'empty', net: 'empty', tls: 'empty', child_process: 'empty' } } module.exports = vuxLoader.merge(webpackConfig, { plugins: ['vux-ui'] })


到此配置完毕!
测试步骤:
测试是否引入成功
1、在vue部件中导包
import { XButton } from 'vux'
2、对XButton进行声明
export default { components: { XButton },}
3、在<template>标签中使用XButton以测试是否配置成功
<x-button type="primary">Top</x-button>
该Vue文件代码:
<template> <div> ============================29、VUX ui框架的使用========================= <div> <!-- 1、cnpm install vux --save 2、cnpm install vux-loader --save-dev 3、cnpm install less less-loader --save-dev --> <!-- @click.native="showPosition('top')" --> <x-button type="primary">Top</x-button> <group-title>自动轮播</group-title> <swiper :list="demo03_list" auto style="width:80%;margin:0 auto;" height="180px" dots-class="custom-bottom" dots-position="center"></swiper> <br/> <br/> <divider>华丽的分割线</divider> <group-title>循环模式</group-title> <swiper loop auto :list="demo06_list" :index="demo06_index" @on-index-change="demo06_onIndexChange"></swiper> <p>current index: {{demo06_index}}</p> </div> </div> </template> <script> import {Swiper} from 'vux' import { XButton } from 'vux' const imgList = [ 'http://placeholder.qiniudn.com/800x300/FF3B3B/ffffff', 'http://placeholder.qiniudn.com/800x300/FFEF7D/ffffff', 'http://placeholder.qiniudn.com/800x300/8AEEB1/ffffff' ] const demoList = imgList.map((one, index) => ({ url: 'javascript:', img: one })) const baseList = [{ url: 'javascript:', img: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vvsr72j20p00gogo2.jpg', title: '送你一朵fua' }, { url: 'javascript:', img: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vw1k2wj20p00goq7n.jpg', title: '送你一辆车' }, { url: 'javascript:', img: 'https://static.vux.li/demo/5.jpg', // 404 title: '送你一次旅行', fallbackImg: 'https://ww1.sinaimg.cn/large/663d3650gy1fq66vw50iwj20ff0aaaci.jpg' }] const urlList = baseList.map((item, index) => ({ url: 'http://m.baidu.com', img: item.img, fallbackImg: item.fallbackImg, title: `(可点击)${item.title}` })) export default { data() { return { demo03_list: demoList, demo06_list: urlList, demo06_index: 0, } }, components: { Swiper, XButton }, methods: { demo06_onIndexChange (index) { this.demo06_index = index }, }, watch: {}, computed: {} } </script> <style scoped> </style>
效果图:

智能推荐
Git的使用教程
Git的使用教程 一 Git与GitHub 这里首先介绍下Git与GitHub是什么东西,他们之间有何区别呢? Git:分布式版本控制系统,最初用在Linux上,可以和SVN、CVS等作为同一个概念理解,目前世界上最先进的分布式版本控制系统(没有之一)。 GitHub:基于Git的项目托管平台,简单的说就是一个网站,通过注册账号后,可以使用Git服务,它提供了可以在上面创建资源仓库的Web页面,通...
JVisualVM 的使用教程
一、简介 Java VisualVM 是一个直观的图形用户界面,基于Java 的应用程序,在给定的 Java 虚拟机(JVM)上运行时提供有关它们的详细信息。Java VisualVM 之所以这样命名,是因为Java VisualVM 可视地提供了有关JVM软件的信息。 Java VisualVM 将多个监视、故障排除和性能分析实用程序组合到一个工具中。 例如,独立工具 jmap,jinfo,js...
Gitbook的使用教程
Gitbook的使用教程 GitBook 是一个基于 Node.js 的命令行工具,支持 Markdown 和 AsciiDoc 两种语法格式,可以输出 HTML、PDF、eBook 等格式的电子书 安装 由于gitbook是基于node.js的,所以在安装gitbook之前需要先安装node。 检验是否安装成功 使用 新建一个文件夹,如myBooks,并在该文件夹目录下执行以下操作。 初始化 此...
Eclipse的使用教程
Eclipse使用教程 ** 一、前期准备 ** 在你JDK环境变量配置好之后,下载安装Eclipse就可以正常运行。 (如何配置JDK环境变量,请关注公众号"Java长征记") 【JDK以及Eclipse等的下载资源在公众号里面有获取方式,或者你也可以直接进入官网下载。】 Eclipse的安装方式: 下载后解压直接点击进入选择工作区间就可运行 ** 二、Eclipse基本...
labelimg的使用教程
1.安装 cmd进入控制台程序,然后输入 2.打开 cmd进入控制台程序,然后输入labelimg,回车即可 3.使用 点击open dir选择图片的路径(例如自己创建的一个photo文件夹,并把原始的图片放在这里面),点击change save dir选择保存的路径(Annotations文件夹,这里是存放勾画结果的)。在view菜单栏中打开auto save mode格式,这个可以帮助我们自动...
猜你喜欢
Mybatis基础(part 1)
一.mybatis调用SQL语句 1.使用XML配置SQL语句 在SqlMapConfig.xml配置数据源并指定映射配置文件的位置(每个DAO对应的XML文件,该文件映射了DAO的全限定类名) 2.使用注解配置sql语句 在SqlMapConfig.xml配置数据源和class属性(指定被注解的dao全限定类名),在DAO上写注解。 用注解来配置,故此处使用class属性指定被注解...
Docker 容器内运行 Dubbo 服务
原文:http://www.aqcoder.com/post/content?id=41 在使用 Docker 容器内运行 Dubbo 服务的时候一个令人很头痛的问题就是服务地址注册。 Docker 容器内有自己的 IP 段,和宿主主机是隔离的,Dubbo 会使用容器内的 IP 注册到 zookeeper 注册中心上。这样其他的服务是无法访问的。 方式一:–host 一个很直接的方案就...
python基础教程
Python基础教程 一、简介 1.1 python语言介绍 python的创始人:Guido Van Rossum Python下载地址:https://www.python.org/ Python文档下载地址:https://www.python.org/doc/ Pycharm下载地址:https://www.runoob.com/w3cnote/pycharm-windows-instal...
1、Git安装与配置
1、Git安装与配置 一:版本控制 定义:版本控制是一种记录一个或若干文件内容变化,以便将来查阅特定版本修订情况的系统。 为什么要用版本控制:在起初的项目开发中,我们会不断的编写代码,但是,害怕有一天系统突然挂掉了,完蛋,辛苦写的代码就这么没了,所有为了防止这一点,都会开发一点就以目录拷贝的形式保存下来,自己这么1.0、2.0、3.0…的这么去标记,开始的还好,后面的话你压根就不知道...
Golang net/rpc 包的深度解读和学习
Golang 提供了一个开箱即用的RPC服务,实现方式简约而不简单。本文对net/rpc 包做深度解读和学习实战。 RPC 简单介绍 远程过程调用 (Remote Procedure Call,RPC) 是一种计算机通信协议。允许运行在一台计算机的程序调用另一个地址空间的子程序(一般是开放网络中的一台计算机),而程序员就像调用调用本地程序一样,无需额外做交互编程。RPC 是一种 CS (Clien...
