element+plus
时间: 2023-11-30 14:42:39 浏览: 64
element-plus
Element Plus是一款基于Vue.js 3.0的开源UI组件库,是Element UI的升级版。提供了一系列的高质量组件,可以帮助开发者快速构建出美观、易用的Web界面。Element Plus的使用方法有两种:
1.通过npm安装并引入组件:
```shell
npm install element-plus --save
```
```javascript
import { createApp } from 'vue'
import ElementPlus from 'element-plus'
import 'element-plus/lib/theme-chalk/index.css'
const app = createApp(...)
app.use(ElementPlus)
```
2.通过浏览器的HTML标签导入Element Plus:
```html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Element Plus Demo</title>
<link rel="stylesheet" href="https://unpkg.com/element-plus/lib/theme-chalk/index.css">
<script src="https://unpkg.com/vue@next"></script>
<script src="https://unpkg.com/element-plus"></script>
</head>
<body>
<div id="app">
<el-button @click="visible = true">显示Dialog</el-button>
<el-dialog :visible.sync="visible">这是一个Dialog</el-dialog>
</div>
<script>
const { createApp } = Vue
const app = createApp({
data() {
return {
visible: false
}
}
})
app.use(ElementPlus)
app.mount('#app')
</script>
</body>
</html>
```
阅读全文