html
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>WEB</title>
</head>
<script src="vue.js"></script>
<script src="axios.min.js"></script>
<body>
<div id="el">
<button v-on:click="YES(1)">增加</button>
<button v-on:click="YES(2)">修改</button>
<button v-on:click="YES(3)">删除</button>
<button v-on:click="YES(4)">查询</button>
<br></br>
<input type="text" v-model="name" placeholder="账号">
<input type="text" v-model="word" placeholder="密码">
<br>
<textarea readonly>{{
Data
}}</textarea>
</div>
</body>
<script>
var vm = new Vue({
el: '#el',
data: {
name:"",
word:"",
Data:"",
},
methods: {
YES: function(flag) {
axios({
url:"ADD",
method:"get",
headers: {'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8'},
params:{
name:vm.$data.name,
password:vm.$data.word,
count:flag
}
}).then(function (response) {
if(flag==4)
{
vm.$data.Data=response.data;
}
});
}
}
})
</script>
</html>