通过CDN
的方式使用VUE 2.0
和Element UI
- 快速上手
VUE
网址
https://cdn.bootcdn.net/ajax/libs/vue/2.7.16/vue.js
源码
https://download.csdn.net/download/HIGK_365/88815507
测试
代码
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello Vue!</title>
</head>
<body>
<div>
<h1>{{info}}</h1>
</div>
<script src="https://cdn.bootcdn.net/ajax/libs/vue/2.7.16/vue.js"></script>
<script>
let v = new Vue(
{
el: "div", // el(element):元素,设置"Vue对象"管理的范围,值的格式为"CSS选择器"
data: {
info: "Hello Vue!"
}
}
)
</script>
</body>
</html>
结果
Element UI
网址
<!-- 引入样式 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
源码
https://download.csdn.net/download/HIGK_365/88815554
测试
代码
<!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://cdn.bootcdn.net/ajax/libs/vue/2.7.16/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}
}
})
</script>
</html>