vue項目引入antDesignUI組件實現(xiàn)
快速安裝ant-design-vue并配置,vue2.0 + antDesign@1.7.8
第一步:安裝ant-deisgn-vue 1.7.8
npm install ant-design-vue@1.7.8 --save
第二步:配置package.json文件,將依賴寫入后,npm install 安裝依賴
"dependencies": { "ant-design-vue": "^1.7.8", "less": "^4.1.3", "less-loader": "^6.2.0", }, "devDependencies": { "babel-plugin-import": "^1.13.8", }
第三步:配置vue.config.js文件
css: { requireModuleExtension: true, loaderOptions: { sass: { sassOptions: { outputStyle: "expanded" } }, less: { lessOptions:{ javascriptEnabled: true, modifyVars: { //在此處設(shè)置,也可以設(shè)置直角、邊框色、字體大小等 'primary-color': '#68BDA8', }, } } } },
第四步:配置babel.config.js文件,加入plugins
module.exports = { presets: [ // https://github.com/vuejs/vue-cli/tree/master/packages/@vue/babel-preset-app '@vue/cli-plugin-babel/preset' ], plugins: [ [ "import", { libraryName: "ant-design-vue", libraryDirectory: "es", style: true } ] ] }
第五步:main引入antDesign ui 組件
//引入less import "ant-design-vue/dist/antd.less" //使用antDesign-vue中的tree組件 import { Tree } from 'ant-design-vue'; import { Table } from 'ant-design-vue'; import { Icon } from 'ant-design-vue'; // 全局組件掛載 Vue.component('ATree', Tree) Vue.component('ATable', Table) Vue.component('AIcon', Icon)
引入成功,使用antDesign-vue 中tree組件效果如下:
到此這篇關(guān)于vue項目引入antDesignUI組件實現(xiàn)的文章就介紹到這了,更多相關(guān)vue 引入antDesignUI內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
在vue中使用express-mock搭建mock服務(wù)的方法
這篇文章主要介紹了在vue中使用express-mock搭建mock服務(wù)的方法,文中給大家提到了在vue-test-utils 中 mock 全局對象的相關(guān)知識 ,需要的朋友可以參考下2018-11-11Vue組合式API--setup中定義響應(yīng)式數(shù)據(jù)的示例詳解
在Vue2.x中,編寫組件的方式是使用Options API,它的特點是在對應(yīng)的屬性中編寫對應(yīng)的功能模塊,這篇文章主要介紹了Vue組合式API--setup中定義響應(yīng)式數(shù)據(jù)詳解,需要的朋友可以參考下2022-10-10vue復(fù)雜表格單元格合并根據(jù)數(shù)據(jù)動態(tài)合并方式
這篇文章主要介紹了vue復(fù)雜表格單元格合并根據(jù)數(shù)據(jù)動態(tài)合并方式,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-02-02