直接从网上链接进文件里,省去下载包(不安全,慎用) https://www.bootcdn.cn/
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- import CSS -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
</head>
<body>
<div id="app">
<el-button @click="visible = true">Button</el-button>
<el-dialog :visible.sync="visible" title="Hello world">
<p>Try Element</p>
</el-dialog>
</div>
</body>
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue@2/dist/vue.js"></script>
<!-- import JavaScript -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script>
new Vue({
el: '#app',
data: function() {
return { visible: false }
},
mounted() {
this.init();
}
methods: {
init() {
const data = {}
axios({ method: "post", url: "xxx/xxx/xxx", data }).then((res) => {
});
}
}
})
</script>
</html>
转自https://element.eleme.cn/#/zh-CN/component/installation