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.pswp.cn/news/247887.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/247887.shtml
英文地址,請注明出處:http://en.pswp.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…