最新文章专题视频专题问答1问答10问答100问答1000问答2000关键字专题1关键字专题50关键字专题500关键字专题1500TAG最新视频文章推荐1 推荐3 推荐5 推荐7 推荐9 推荐11 推荐13 推荐15 推荐17 推荐19 推荐21 推荐23 推荐25 推荐27 推荐29 推荐31 推荐33 推荐35 推荐37视频文章20视频文章30视频文章40视频文章50视频文章60 视频文章70视频文章80视频文章90视频文章100视频文章120视频文章140 视频2关键字专题关键字专题tag2tag3文章专题文章专题2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章专题3
当前位置: 首页 - 科技 - 知识百科 - 正文

vue的数据交互形式有哪些

来源:动视网 责编:小采 时间:2020-11-27 15:07:44
文档

vue的数据交互形式有哪些

vue的数据交互形式有哪些:var that=this get请求that.$http.get("1.txt").then(function(result){console.log(result)this.msg=result.data;})post请求 需要环境 发送数据 接收数据that.$http.post("1.txt","&
推荐度:
导读vue的数据交互形式有哪些:var that=this get请求that.$http.get("1.txt").then(function(result){console.log(result)this.msg=result.data;})post请求 需要环境 发送数据 接收数据that.$http.post("1.txt","&


var that=this

get请求

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

console.log(result)

this.msg=result.data;

})

post请求 需要环境 发送数据 接收数据

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

console.log(result)

})

综合性请求

that.$http({

method:"get",

url:"1.txt"

}).then(function(result){

console.log(result.data)

})

es6请求 method 请求方式 cache 是否缓存是否重新加载

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

})

vue2 请求

axios({

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

method:"get/post",

如果是get请求的话 用params 来传输数据或者地址栏拼接

params:{

pageStart:1,

pageSize:3

}

如果是post请求的话 用data去传输数据

data:{

}

})

实例

百度跨域请求

var that=this;

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

console.log(result.data.s)

})

360跨域请求

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)})

文档

vue的数据交互形式有哪些

vue的数据交互形式有哪些:var that=this get请求that.$http.get("1.txt").then(function(result){console.log(result)this.msg=result.data;})post请求 需要环境 发送数据 接收数据that.$http.post("1.txt","&
推荐度:
标签: 的数据 数据 VUE
  • 热门焦点

最新推荐

猜你喜欢

热门推荐

专题
Top