Home > Web Front-end > H5 Tutorial > What are the data interaction forms of Vue?

What are the data interaction forms of Vue?

零下一度
Release: 2017-06-30 15:25:39
Original
2225 people have browsed it

var that=this

get request

that.$http.get(" 1.txt").then(function(result){

##console.log(result)

this.msg=result.data ;

})

post request requires environment to send data and receive data

##that.$ http.post("1.txt","").then(function(result){

console.log(result)

})

Comprehensive request

that.$http({

method: "get",

url:"1.txt"

##}).then(function(result){

console.log(result.data)

})

es6 request method request method cache whether to cache or not Reload

fetch("url",{method:"get",cache:"reload"}).then(function(){

})

##vue2 Request

axios({

url:"www.baidu.com?pageStart=18pageSize=3

",

method:"get/post",

If it is a get request, use params to transmit data or address bar splicing

params:{

##pageStart:1 ,

pageSize:3

}

If it is a post request, use data to transmit Data

data:{

}

})

Instance

##Baidu cross-domain request

var that=this;

##that.$http.jsonp("

",{wd:this.abc},{jsonp:"cb"}).then(function(result){

console. log(result.data.s)

})

360 Cross-domain request

that.$http.jsonp("https://sug.so.360.cn/suggest?encodein=utf-8&encodeout=utf-8",{word:this.abc},{emulateJSON:true}).then( function(result){console.log(result.data.s)})

The above is the detailed content of What are the data interaction forms of Vue?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template