I'm trying to use the ElementPlus as a global API but it is not working. I add the Vue 3 unpkg link in HTML and ElementPlus unpkg link to run. But no output for ElementPlus.
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<script src="https://unpkg.com/vue@next"></script>
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
<!-- import JavaScript -->
<script src="https://unpkg.com/element-plus"></script>
<title>Element Plus demo</title>
</head>
<body>
<div id="app">
<el-button>{{ message }}</el-button>
</div>
<script>
const App = {
data() {
return {
message: "Hello Element Plus",
};
},
};
const app = Vue.createApp(App);
app.use(ElementPlus);
app.mount("#app");
</script>
</body>
</html>
Check your browser's dev tools. The network tab shows 404 for the vue package, and it's obvious why when you try to open the link https://unpkg.com/vue@next
The Element Plus documentation for unpkg shows what the link should actually be: https://unpkg.com/vue@3
Your updated code should then be: