123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- import {createApp } from 'vue';
- console.log(router);
- const app=createApp({
- template:'#app',
- components:{
- Home,
- },
- data(){
- return{
- info:`<span style='color:red; font-size:30px'>hello vue template</span>`,
- number:0,
- locale:null,
- books:[
- {username:"Linux从入门到精通",nickname:"night-cherry",password:"peking press",descrption:"123"},
- ],
- }
- },
- methods:{
- interface_web(){
- console.log("---------tomcat server----------");
- console.log("this.tomcat_res : "+this.tomcat_res);
- console.log("------this.books : "+this.books);
- const _books=this.books;
- let _tomcat_res=this.tomcat_res;
-
- const request = new XMLHttpRequest();
- request.onload=function(){
- console.log("--------parse tomcat server string--------");
- const res=JSON.parse(request.responseText);
- _tomcat_res=res[0].usename;
- console.log("res:"+res);
- console.log("res[0].usename :"+res[0].usename);
- console.log("res[0].nickname :"+res[0].nickname);
- console.log("res[0].password :"+res[0].password);
- console.log("res[0].description :"+res[0].description);
- console.log("res[1]:"+res[1]);
- console.log("res[1][\"usename\"] :"+res[1]["usename"]);
- console.log("res[1][\"nickname\"] :"+res[1]["nickname"]);
- console.log("res[1].password :"+res[1].password);
- console.log("res[1].description :"+res[1].description);
- console.log("this.tomcat_res : "+this.tomcat_res);
- alert("this.tomcat_res : "+_tomcat_res);
-
- console.log("------ _books : "+_books);
-
- try{
- for(const item of res){
- console.log(item);
- _books.push(item);
- }
-
- }catch(e){
- console.log("the way == _books.push(res[0]) is wrong!!!");
- try{
- _books.push(res[0]);
- }catch(e){
- console.log("the way == _books.push(res[0]) is wrong!!!");
- }
- }finally{
- console.log("--object array operation done--");
- }
-
-
- console.log("this.tomcat_res : "+_tomcat_res);
- };
- request.open("POST","http://ancientapes.cc:8080/maven/book_quick");
- request.send("test tomcat");
- }
-
- },
- setup(){
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- }).mount("#app");
-
|