1、新建一个HTML文件
2、HTML文件引用vue3.js
3、引用elementplus.js和elementplus.css
4、Vue初始化ElementPlus
5、页面中可以使用ElementPlus啦
HTML文件例子如下:
html
<html>
<head>
<meta charset="UTF-8">
<script src="./js/vue3.js"></script>
<script src="./js/element-plus@2.8.0.js"></script>
<link rel="stylesheet" href="./css/element-plus@2.8.0.css"></link>
</head>
<body>
<div id="app">
<p>{{title}}</p>
<el-button @click="btnClick" type="primary">ElementPlus按钮</el-button>
</div>
<script>
const { createApp } = Vue
const vue = createApp({
setup(){
const title = "vue3+elementPlus"
const btnClick = () => {
console.log("btnClick")
}
return {
title,
btnClick
}
}
})
vue.use(ElementPlus)
vue.mount("#app")
</script>
</body>
</html>
效果如下: