vux 组件库首次使用安装

1、首先通过脚手架新建一个项目,过程略。

创建完项目后,在项目里安装vux, 通过命令 npm install vux --save 安装

2、安装vux-loader,

通过命令 npm install vux-loader --save-dev 安装(vux文档没说明)

3、安装less-loader,

通过命令 npm install less less-loader --save-dev 安装

4、在文件根目录下创建 build 文件夹

在 build 文件夹中创建 webpack.base.conf.js 文件 ,并进行配置

4.1、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)
}
const vuxLoader = require('vux-loader')
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','.less'],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'] })

5、然后根据 vux 组件库官方的方式进行 局部 、 全局 的引入并使用即可

案例: 以下为局部引入案例

在 vue 的单页面文件夹中设置

<template><div><divider>default</divider><box gap="10px 10px"><x-button>submit</x-button><x-button type="primary">primary</x-button><x-button type="warn">Delete</x-button><divider>link</divider><x-button type="primary" link="/demo">Go to demo list</x-button><x-button type="default" link="BACK">Back</x-button><divider>action type</divider><x-button type="primary" action-type="button">submit</x-button><x-button type="warn" action-type="reset">reset</x-button><divider>loading</divider><x-button type="default" show-loading>submit</x-button><x-button type="primary" show-loading>submit</x-button><x-button type="warn" show-loading>submit</x-button><divider>mini</divider><x-button mini>submit</x-button><x-button mini type="primary">primary</x-button><x-button mini type="warn">Delete</x-button><br><x-button mini plain>submit</x-button><x-button mini plain type="primary">primary</x-button><x-button mini plain type="warn">primary</x-button><divider>plain</divider><x-button plain>submit</x-button><x-button plain type="primary">primary</x-button><x-button plain type="warn">warn</x-button><divider>you can customize styles</divider><x-button plain type="primary" style="border-radius:99px;">primary</x-button><x-button plain type="primary" class="custom-primary-red">primary</x-button><divider>disabled</divider><x-button disabled>disable submit</x-button><x-button type="primary" disabled>disable primary</x-button><x-button type="warn" disabled>disable Delete</x-button><x-button mini disabled>disable mini submit</x-button><x-button mini type="primary" disabled>disable mini primary</x-button><x-button mini type="warn" disabled>disable mini Delete</x-button><x-button plain disabled>disable plain</x-button><x-button plain type="primary" disabled>disable plain primary</x-button><divider>use :text and :disabled</divider><x-button :text="submit001" :disabled="disable001" @click.native="processButton001" type="primary"></x-button><divider>combined with flexbox</divider><flexbox><flexbox-item><x-button type="primary">primary</x-button></flexbox-item><flexbox-item><x-button type="warn">Delete</x-button></flexbox-item></flexbox><divider>combined with flexbox</divider><flexbox><flexbox-item><x-button type="default">default</x-button></flexbox-item><flexbox-item><x-button type="primary">primary</x-button></flexbox-item><flexbox-item><x-button type="warn">Delete</x-button></flexbox-item></flexbox></box><divider>iOS Gradients(v2.7.4)</divider><box gap="10px 10px"><x-button :gradients="['#1D62F0', '#19D5FD']">iOS Gradients</x-button><x-button :gradients="['#A644FF', '#FC5BC4']">iOS Gradients</x-button><x-button :gradients="['#FF2719', '#FF61AD']">iOS Gradients</x-button><x-button :gradients="['#6F1BFE', '#9479DF']">iOS Gradients</x-button><x-button :gradients="['#FF5E3A', '#FF9500']">iOS Gradients</x-button></box></div>
</template><script>
// 局部引入对应的组件
import { XButton, Box, Flexbox, FlexboxItem, Divider } from 'vux'export default {
// 对应的组件实例化components: {XButton,Box,Flexbox,FlexboxItem,Divider},methods: {change (value) {console.log('change:', value)},processButton001 () {this.submit001 = 'processing'this.disable001 = true}},data () {return {submit001: 'click me',disable001: false}}
}
</script><style lang="less">
.custom-primary-red {border-radius: 99px!important;border-color: #CE3C39!important;color: #CE3C39!important;&:active {border-color: rgba(206, 60, 57, 0.6)!important;color: rgba(206, 60, 57, 0.6)!important;background-color: transparent;}
}
</style>

效果图:

在这里插入图片描述

注意引入出现以下报错时:

在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/247887.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

@Component 和 @Bean 的区别

Spring帮助我们管理Bean分为两个部分&#xff0c;一个是注册Bean&#xff0c;一个装配Bean。完成这两个动作有三种方式&#xff0c;一种是使用自动配置的方式、一种是使用JavaConfig的方式&#xff0c;一种就是使用XML配置的方式。 Compent 作用就相当于 XML配置 Component pub…

js动态验证码获取

<!DOCTYPE html> <html lang"cn"> <head><meta charset"UTF-8"><title>短信验证码</title> </head> <body> <input type"number" id"tel" value"13303861063"> <…

Base64 算法原理,以及编码、解码【加密、解密】 介绍

Base64编码&#xff0c;是我们程序开发中经常使用到的编码方法。它是一种基于用64个可打印字符来表示二进制数据的表示方法。它通常用作存储、传输一些二进制数据编码方法&#xff01;也是MIME&#xff08;多用途互联网邮件扩展&#xff0c;主要用作电子邮件标准&#xff09;中…

js通过身份证获取年龄

// 获取用户的身份证号码let identityCard this.idNum.replace(/\s/g, "");//判断长度let len identityCard.length;//设置新的变量var strBirthday "";//根据长度获取年月日if (len 18) {strBirthday identityCard.substr(6, 4) "/" identi…

爬取豆瓣top250

#xpath #第一种方法 可在开发者工具中找到标签&#xff0c;右键copy xpath&#xff0c;有时需去掉tbody标签 #第二种方法 简单学习xpath&#xff0c;自己书写&#xff0c;掌握基本语法即可&#xff0c;简单的层级关系#先将csv文件以记事本打开&#xff0c;更改编码为ASNI&…

TCP/IP,Http,Socket,XMPP的区别

网络由下往上分为 物理层、数据链路层、网络层、传输层、会话层、表示层和应用层。 通过初步的了解&#xff0c;我知道IP协议对应于网络层&#xff0c;TCP协议对应于传输层&#xff0c;而HTTP协议对应于应用层&#xff0c; 三者从本质上来说没有可比性&#xff0c; socket则是对…

LED音乐频谱之点阵

转载请注明出处&#xff1a;http://blog.csdn.net/ruoyunliufeng/article/details/37967455 一.硬件 这里的LED选择直插的雾面LED&#xff0c;亮度可以还不失美观。注意每行要加上限流电阻。74HC138&#xff08;三八译码器&#xff09;作为列选&#xff0c;每行都连着74HC595&a…

上架相关——App Store 上架流程

说实话&#xff0c;公司要上架一个自己做的一个小项目。为了完成这个任务&#xff0c;菜鸟的我一遍找资料一遍跟着做&#xff0c;一遍修改错误一遍查找解决方案。网上的资料大部分都是2015年以前的资料&#xff0c;资料有点不够过时&#xff0c;而且步骤配图也不是很详细&#…

this.$router 的三种跳转页面方法

第一种&#xff1a; this.$router.push(需要跳转到的路径名称)此方法跳转后&#xff0c;会在历史栏目中保存路劲地址&#xff0c;当点击历史标签时可以进行访问 第二种&#xff1a; this.$router.replace(需要跳转到的路径名称)此方法跳转后&#xff0c;会在历史栏目中不保存…

cf777c

题意&#xff1a;给你一个n*m的数阵 对于一行到另一行&#xff0c;若存在一列从上到下递减&#xff0c;则称之符合题意 The first line of the input contains two positive integers n and m (1 ≤ nm ≤ 100 000) — the number of rows and the number of columns in t…

上架相关——appstore 更新app版本

注&#xff1a;此片文章是基于app已经上架&#xff0c;也就是证书都已经配置好的前提下。 首先是还是app打包 修改版本号 修改project处的pp文件 检查无误后打包打包完成后upload to app store 漫长的等待。。 上传到appstore进入iTunesConnect 选择我的app 选择对应app点…

输入框输入数字,且不能有小数点存在

基于Vue项目进行设置 <template><comp v-if"update"></comp><button click"reload()">刷新comp组件</button></template><script>import comp from /views/comp.vueexport default {name: parentComp,data() {r…

iOS开发 蓝牙技术4.0详解

前言 前端时间,同学在做项目过程中遇到关于蓝牙方面的问题,今天我就给大家进行详细的进行讲解下蓝牙在iOS开发中的具体实现.在介绍蓝牙前,大家要搞清楚什么是蓝牙? 什么是蓝牙? 随着蓝牙低功耗技术BLE&#xff08;Bluetooth Low Energy&#xff09;的发展&#xff0c;蓝牙技术…

前端面试题(五)

position的属性有哪些&#xff1f; 1、absolute生成绝对定位的元素&#xff0c;相对于值不为 static的第一个父元素进行定位。 2、fixed &#xff08;老IE不支持&#xff09;生成绝对定位的元素&#xff0c;相对于浏览器窗口进行定位。 3、relative生成相对定位的元素&#xff…

qrcode.js 二维码生成器

二维码生成 并显示&#xff1a; <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns"http://www.w3.org/1999/xhtml" xml:lang"ko" …

SQL -- 多表查询

-- --SQL基础-->多表查询 -- /* 一、多表查询 简言之&#xff0c;根据特定的连接条件从不同的表中获取所需的数据 笛卡尔集的产生条件&#xff1a; 省略连接条件 连接条件无效 第一个表中的所有行与第二个表中的所有行相连接 二、多表查询语法&#xff1a;*/ SELECT tab…

如何解决两个相邻的span中间有空隙

span中间不要有换行、或者空格 或者在样式上加上float&#xff1a;left转载于:https://www.cnblogs.com/lst619247/p/10944341.html

Vue项目中Table设置 render 函数

statusList1: {0: "",1: "",2: "药品服务费收入",3: "特药服务费收入",4: "直保经纪费",5: "再保经纪费",6: "广告费",},render: (h, params) > {return this.colorCommon(h, params.row, "1&q…

AVPlayer设置从哪儿开始播放

avplayer 播放视频 首先介绍几个方法吧和属性吧。 - (id)addPeriodicTimeObserverForInterval:(CMTime)interval queue:(dispatch_queue_t)queue usingBlock:(void (^)(CMTime time))block 这个方法可以用于跟新进度条。 - (void)seekToTime:(CMTime)time completionHandler:(v…

老男孩爬虫实战密训课第一季,2018.6,初识爬虫训练-实战1-爬取汽车之家新闻数据...

1.爬虫介绍 编写程序&#xff0c;根据URL获取网站信息 2.用到的库 requests库 bs4库 3.内容及步骤 4.代码 import requests import os from bs4 import BeautifulSoup # 1.下载页面 ret requests.get(urlhttps://www.autohome.com.cn/news/) ret.encoding ret.apparent_encod…