1.生命周期
从Vue 从实列创建 运行到销毁的发生的所有事件交生命周期
1.生命周期的图
生命周期的八个事件
beforeCreate:vue实例初始化之前调用
created :vue实例初始化之后调用
beforeMount:挂载到DOM树之前调用
mounted:挂载到DOM树之后调用
beforeUpdate:数据更新之前调用
updated:数据更新之后调用
beforeDestroy:vue实例销毁之前调用
destroyed:vue实例销毁之后调用
axios的使用
GET请求:
get('网址加拼接')
拼接用?加上值
.then(response => (this.info = response))
.catch(function (error) { // 请求失败处理
console.log(error);
});
POST请求
axios.post('网址',{值},)
.then(response => (this.info = response))
.catch(function (error) { // 请求失败处理
console.log(error);
});
另一种不是josn格式 的加
let url1 = new URLSearchParams()
url1.append('值', '值'),
axios.post(`${网址`, url1).then(res => {
})