cdn引入vue和element-ui组件



可以在html和jsp页面引入vue和element-ui等组件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<!DOCTYPE html>
<html>

<head>
<meta charset="UTF-8">
<!-- import CSS -->
<!-- <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> -->
<link href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/theme-chalk/index.css" rel="stylesheet">
<!-- import Vue before Element -->
<script src="https://unpkg.com/vue/dist/vue.js"></script>
<!-- import JavaScript -->
<!-- <script src="https://unpkg.com/element-ui/lib/index.js"></script> -->
<script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/index.js"></script>
<script src="https://cdn.staticfile.org/axios/0.19.1/axios.min.js"></script>
</head>

<body>
<div id="app">
<el-button @click="visible = true">Button</el-button>
<el-dialog :visible.sync="this.visible" title="Hello world">
<p>Try Element</p>
<el-tag type="success">标签二</el-tag>
</el-dialog>
</div>
</body>
<script>
// 必须实例化vue,不然引入element-ui渲染无效
var app = new Vue({
el: '#app',
data() {
return {
helloData: {},
visible: false
}
},
created() {
this.clickMe()
},
methods: {
clickMe() {
// axios使用
axios.put('http://localhost:8081/powers/list')
.then(res => {
if (res.data.code === 200) {
console.log(res.data)
this.rightsList = res.data.data
this.$message.success('查询成功')
}
})
.catch(err => {
this.$message.error('查询失败:' + err)
})
}
}
})
</script>

</html>

常用的cdn

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<link rel="stylesheet" href="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.css">

<!-- element-ui 的样式表文件 -->
<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
<link href="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/theme-chalk/index.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.staticfile.org/element-ui/2.13.0/theme-chalk/index.css">

// 引入vue
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="https://cdn.staticfile.org/vue/2.6.10/vue.min.js"></script>

<script src="https://cdn.staticfile.org/vue-router/3.1.3/vue-router.min.js"></script>

// 引入axios
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<script src="https://cdn.staticfile.org/axios/0.19.1/axios.min.js"></script>

<script src="https://cdn.staticfile.org/echarts/4.7.0/echarts.min.js"></script>

<script src="https://cdn.staticfile.org/nprogress/0.2.0/nprogress.min.js"></script>

<!-- element-ui 的 js 文件 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/element-ui/2.13.2/index.js"></script>
<script src="https://cdn.staticfile.org/element-ui/2.13.0/index.js"></script>

-----------------------------------------

<link href="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/theme/default/layer.min.css" rel="stylesheet">

<script src="https://cdn.bootcdn.net/ajax/libs/layer/3.1.1/layer.js"></script>
打赏
  • 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!
  1. © 2020 Liu Yang    湘ICP备20003709号

请我喝杯咖啡吧~

支付宝
微信