NaiveUI安装及使用

1、安装UI组件库 naive-ui

yarn add naive-ui

 

2、全局按需引入

src下新建uitls目录并添加uaiveUI.ts

// src/utils/naiveUI.ts

import {

  create,

  NButton

} from 'naive-ui'

export const naiveUI = create({

  components: [NButton]

})

 

3、在main.ts中导入可全局使用

import { createApp } from 'vue'

import './style.css'

import App from './App.vue'

import router from './router'

import { naiveUI } from './utils/naiveUI'

createApp(App).use(router).use(naiveUI).mount('#app')

 

4、具体页面直接通过标签使用