console
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>sweetalert.js</title>
<meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport" />
<meta name="renderer" content="webkit" />
<style>
* {
margin: 0;
padding: 0;
list-style: none;
}
body {
font-size: 14px;
font-family: -apple-system, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Helvetica Neue, Arial, sans-serif;
color: #27282b;
background: #fff;
}
a {
text-decoration: none;
color: #27282b;
}
*,
*::before,
*::after {
outline: none;
box-sizing: border-box;
}
html,
body {
height: 100%;
}
.d1 {
width: 50%;
height: 100px;
background: #eee;
user-select: none;
position: relative;
margin: 0 auto 50px auto;
}
</style>
</head>
<body>
<div class="wrapper" id="app">
<div class="d1" @click="func1"></div>
</div>
<script src="https://lib.baomitu.com/vue/2.6.11/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/sweetalert@2.1.2/dist/sweetalert.min.js"></script>
<script>
const sw = {
success(msg, content='') {
return swal(msg, content, 'success')
},
error(msg, content='') {
return swal(msg, content, 'error')
},
warning(msg, content='') {
return swal(msg, content, 'warning')
},
info(msg, content='') {
return swal(msg, content, 'info')
},
}
const vm = new Vue({
el: '#app',
data() {
return {
a_list: [],
}
},
methods: {
func1() {
sw.success('标题')
},
func2() {},
},
})
</script>
</body>
</html>