vuejs3.0 从入门到精通——Element Plus 组件库

发布时间 2023-11-09 09:43:45作者: 左扬

Element Plus 组件库

一、Element Plus

  基于 Vue 3,面向设计师和开发者的组件库。

二、完整导入

https://element-plus.org/zh-CN/guide/quickstart.html

  如果你对打包后的文件大小不是很在乎,那么使用完整导入会更方便。

// main.ts
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'

const app = createApp(App)

app.use(ElementPlus)
app.mount('#app')

 三、Volar 支持

  如果您使用 Volar,请在tsconfig.json中通过compilerOptions.type指定全局组件类型。

// tsconfig.json
{
  "compilerOptions": {
    // ...
    "types": ["element-plus/global"]
  }
}