# 快速上手
在项目中使用cl-ui
# 引入 cl-ui
import CLUI from '@chen129/cl-ui'
import '@chen129/cl-ui/package/clUi.css'
Vue.use(CLUI)
# 按需引入
- 借助插件 babel-plugin-import可以实现按需加载组件,减少文件体积。首先安装,并在文件 babel.config.js 中配置:
npm install babel-plugin-import --save-dev
// babel.config.js
module.exports = {
...
plugins: [['import', {
'libraryName': '@chen129/cl-ui',
'libraryDirectory': 'src/components'
}]]
}
// main.js
import { Hello } from '@chen129/cl-ui'
import '@chen129/cl-ui/package/index.css'
Vue.component(Hello.name, Hello)
//or
Vue.use(Hello)
← 安装 CountUP 数字累加 →