我一直在使用"element-ui“,现在转向新版本的Vue3。似乎他们发布了一个名为"element-plus“的新版本,但教程并没有更新。
import Vue from 'vue'; // not working in Vue3
import ElementUI from 'element-plus';
import 'element-ui/lib/theme-chalk/index.css';
...
Vue.use(ElementUI); // no "Vue" in Vue3 anymore
...
createApp(App).mount('#app') // the new project creation
https://element-plus.org/#/en-US/component/quickstart
有没有人被命令去做正确的事情,并且它起作用了?
发布于 2021-09-23 10:08:46
你也可以在没有任何js绑定器的情况下很容易做到这一点。
下面是一个示例:
var Main = {
data() {
return {
message: 'Hello World!'
}
},
methods: {
click() {
console.log('click()');
}
}
};
const app = Vue.createApp(Main);
app.use(ElementPlus);
app.mount("#app")
<html>
<head>
<link rel="stylesheet" href="//unpkg.com/element-plus/theme-chalk/index.css">
</head>
<body>
<script src="//unpkg.com/vue@next"></script>
<script src="//unpkg.com/element-plus/dist/index.full.js"></script>
<div id="app">
<el-button type="primary" size="medium" @click="click">{{message}}</el-button>
</div>
</body>
</html>
https://stackoverflow.com/questions/64134028
复制相似问题