<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
<script src="//unpkg.com/vue/dist/vue.js"></script>
<style type="text/css">
</style>
</head>
<body>
<div id="app">
<button type="button" @click="myswal">点我</button>
</div>
</body>
<script type="text/javascript">
var vm = new Vue({
el:'#app',
data:{
value:"1111"
},
methods:{
myswal:function(){
(async () => {
const { value: fruit } = await Swal.fire({
title: 'Select field validation',
input: 'select',
inputOptions: {
'Fruits': {
apples: 'Apples',
bananas: 'Bananas',
grapes: 'Grapes',
oranges: 'Oranges'
},
'Vegetables': {
potato: 'Potato',
broccoli: 'Broccoli',
carrot: 'Carrot'
},
'icecream': 'Ice cream'
},
inputPlaceholder: 'Select a fruit',
showCancelButton: true,
inputValidator: (value) => {
return new Promise((resolve) => {
if (value === 'oranges') {
resolve()
} else {
resolve('You need to select oranges :)')
}
})
}
})
if (fruit) {
Swal.fire(`You selected: ${fruit}`)
}
})()
}
}
})
</script>
</html>
//<div style="width:100%" class="selectTree" id="selectTree"></div>//html
//var mytreedata = JSON.parse(data.zTreeNodes);//后台获取的数据
//$("#selectTree").data("data", mytreedata);//给页面赋值
//现在就是想两个结合在一起。。。这可咋整呢