Browse Source

connection to java web project

night-cherry 1 month ago
parent
commit
163292b254
2 changed files with 15 additions and 5 deletions
  1. 1 0
      index.html
  2. 14 5
      index.js

+ 1 - 0
index.html

@@ -39,6 +39,7 @@
 		<p>after i18n label</p>
 		<label @click="changelang('zh')">中文</label>
 		<label @click="changelang('en')">english</label>
+		<button @click="interface()">english</button>
 		<!--<input type="button" text="中文" @click="changelang('zh')"/>
 		<input type="button" text="english" @click="changelang('en')"/>-->
 		<p>

+ 14 - 5
index.js

@@ -79,11 +79,20 @@ const app=createApp({
       this.number++;
     },
 
-changelang(type){
-  console.log(locale);
-  console.log("-----------changelang-----------------");
-  locale.value=type;
-}
+  changelang(type){
+    console.log(locale);
+    console.log("-----------changelang-----------------");
+    locale.value=type;
+  },
+  interface(){
+    const request = new XMLHttpRequest();
+    request.onload=function(){
+      const res=JSON.parse(request.responseText);
+      console.log("res:"+res);
+    };
+    request.open("POST","http://ancientapes.cc:8080/mineluxuries/book");
+    
+  }
 
   },
   setup(){