liuyuqi-dellpc 6 years ago
parent
commit
3bc4617cb1
2 changed files with 6 additions and 26 deletions
  1. 6 2
      Basic/网络/ajax.html
  2. 0 24
      Basic/网络/响应接口.html

+ 6 - 2
Basic/网络/ajax.html

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

+ 0 - 24
Basic/网络/响应接口.html

@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html lang="zh">
-
-<head>
-    <title></title>
-    <meta charset="UTF-8">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
-    <link href="../css/style.css" rel="stylesheet"> </head>
-
-<body>
-<div id="myApp">
-</div>
-<script>
-    var myApp = new Vue({
-        el: '#myApp',
-        data: {
-           
-        },
-    });
-</script>
-</body>
-
-</html>