|
@@ -11,7 +11,7 @@
|
|
|
|
|
|
<body>
|
|
|
<div id="myApp">
|
|
|
- <input type="button" @click="get()" value="点我异步获取数据(Get)">
|
|
|
+ <input type="button" @click="btnGet()" value="点我异步获取数据(Get)">
|
|
|
</div>
|
|
|
<script>
|
|
|
var vm = new Vue({
|
|
@@ -20,17 +20,21 @@
|
|
|
msg: 'Hello World!',
|
|
|
},
|
|
|
methods: {
|
|
|
- get: function() {
|
|
|
+ btnGet: function() {
|
|
|
//发送get请求
|
|
|
var data = {
|
|
|
a: 1,
|
|
|
b: 2
|
|
|
};
|
|
|
this.$http.get('ajax_info.txt', data).then(function(res) {
|
|
|
+ document.write("<h3>已经获取到数据:</h3>");
|
|
|
document.write(res.body);
|
|
|
}, function() {
|
|
|
console.log('请求失败处理');
|
|
|
});
|
|
|
+ },
|
|
|
+ btnPost:function(){
|
|
|
+ //post请求
|
|
|
}
|
|
|
}
|
|
|
});
|