php:

<?php 
header('Access-Control-Allow-Origin:*');

$date = $_POST['data'];
$cars=array("Volvo","BMW","SAAB");

$data = array( 
'tid' => 100, 
'name' => $date, 
'site' => 'www.huangyibiao.com',
'post' =>$cars,
);

$response = array( 
'code' => 200, 
'message' => 'success for request', 
'data' => $data,

);

echo json_encode($response);

?>

 

vue:

 

<div
},
mounted:function(){
this.click();
},
methods:{
click:function(){

Vue.http.options.emulateJSON = true;
this.$http.post('http://localhost/php01/index.php',{'data':2}).then(function(response){
this.title=response.body.data.post
}, function(response){
console.log("222");
});
}
}
})
</script>

相关文章:

  • 2021-12-13
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-30
  • 2021-12-13
  • 2021-12-23
猜你喜欢
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2022-12-23
  • 2021-12-13
相关资源
相似解决方案