标签:.com console url 组件 col res com method rip
vue-resource
1.cnpm install vue-resource --save
2.在main.js中import VueResource from ‘vue-resource‘
3.在main.js中Vue.use(VueResource)
4.在组件中使用this.$http.get(url).then((response)=>{},(err)=>{})
<template> <div id="app"> <div v-html="htmlValue"></div> </div> </template> <script> import Home from "./components/Home.vue"; export default { name: "app", data() { return { flag: true, htmlValue: "" }; }, methods: { getData() { this.$http.post(`http://360.com/api/auth/login`).then( res => { console.log(res); this.htmlValue = res.body; }, err => {} ); } }, mounted(){ this.getData(); } }; </script> <style lang="scss"> </style>
标签:.com console url 组件 col res com method rip
原文地址:https://www.cnblogs.com/chenyishi/p/9160731.html