https://www.cnblogs.com/jflalove/p/11944483.html
https://blog.csdn.net/qq_40236722/article/details/88175015
axios的使用:
/**
*
* 使用axios的步驟;
* 第一步安裝 npm install --save axios vue-axios
第二步,在mian.js中導入和配置, (這是全局的axios)
引入:
import axios from 'axios'
Vue.use(axios)
配置 :
axios.defaults.baseURL="https://wd4363557576ckikwp.wilddogio.com/"
第三步在你要使用的文件下引用axios
*/
第二種配置
import axios from 'axios'
與很多第三方模塊不同的是,axios不能使用use方法,轉而應該進行如下操作

axios 發送數據:
const fromData={
age:this.ruleForm.age,
pass:this.ruleForm.pass
}
//發送數據
axios.post('./axiosT.json',fromData)
.then(res=>{//當數據發送成功時回調
console.log("數據發送成功")
console.log(res.data)
})
.catch((error)=>{
console.log(error)
})
接受數據:
mounted () {
var that = this
axios.get('/Produce.json')
.then(function(response){
console.log(response.data)
that.produce=response.data
})
.catch(error => console.log(error))//檢查問題 :例如
- API 不工作了;
- 請求發錯了;
- API 沒有按我們預期的格式返回信息。
}
elementUi的使用:
vue.esm.js?efeb:628 [Vue warn]: Unknown custom element: <el-carousel> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
found in
---> <ElementUi> at src/components/elementUi.vue
<App> at src/App.vue
<Root>
這個錯誤是因為沒有注冊組件在main.js里面
import ElementUI from 'element-ui'; import 'element-ui/lib/theme-chalk/index.css'; //注冊組件 Vue.use(ElementUI);

