摘要: <template> <div class="app"> 姓名:{{$store.state.nameVuex}} <button @click="btn">基本方法 : 修改名字</button> <br/> <button @click="btn1">传递值 : 修改名字</button> <h 阅读全文
posted @ 2022-08-29 18:14 杨建鑫 阅读(809) 评论(0) 推荐(0) 编辑
摘要: <template> <div class="app"> 姓名:{{$store.state.nameVuex}} <button @click="btn">基本方法 : 修改名字</button> <br/> <button @click="btn1">传递值 : 修改名字</button> <h 阅读全文
posted @ 2022-08-29 18:04 杨建鑫 阅读(200) 评论(0) 推荐(0) 编辑
摘要: app.vue <template> <div class="app"> <h3>在模板中直接使用(vue2-3都可用)</h3> 计算 : {{ $store.getters.counterGetter }} <br/> 年龄 : {{ $store.getters.usersAgesGetter 阅读全文
posted @ 2022-08-29 17:21 杨建鑫 阅读(272) 评论(0) 推荐(0) 编辑
摘要: import { createStore } from 'vuex' export default createStore({ state: { nameVuex:'yjx', levelVuex:100, avtarURLVuex:'http', counterVuex:100, friends: 阅读全文
posted @ 2022-08-29 17:20 杨建鑫 阅读(1341) 评论(0) 推荐(0) 编辑
摘要: <template> <div class="app"> <h3> 在模板中直接使用(vue2-3都可用) </h3> 姓名 : {{ $store.state.nameVuex }} 等级 : {{ $store.state.levelVuex }} 头像 : {{ $store.state.av 阅读全文
posted @ 2022-08-29 16:17 杨建鑫 阅读(306) 评论(0) 推荐(0) 编辑
摘要: app.vue <template> <div class="app"> <h3> 在模板中直接使用 </h3> 姓名 : {{ $store.state.nameVuex }} 等级 : {{ $store.state.levelVuex }} 头像 : {{ $store.state.avtar 阅读全文
posted @ 2022-08-29 15:51 杨建鑫 阅读(187) 评论(0) 推荐(0) 编辑
摘要: // 对实例配置拦截器 // 请求拦截器 - 参数1:成功(一般参数叫config) 参数2:失败 axios.interceptors.request.use((config) => { console.log("请求成功的拦截") // 1.开始loading的动画 // 2.对原来的配置进行一 阅读全文
posted @ 2022-08-29 12:08 杨建鑫 阅读(43) 评论(0) 推荐(0) 编辑
摘要: // axios默认库提供给我们的实例对象 axios.get("http://123.207.32.32:9001/lyric?id=500665346") // 创建其他的实例发送网络请求 create 返回 一个新的实例 const instance1 = axios.create({ bas 阅读全文
posted @ 2022-08-29 11:59 杨建鑫 阅读(203) 评论(0) 推荐(0) 编辑
摘要: // 2.axios发送多个请求 // Promise.all axios.all([ axios.get("http://123.207.32.32:8000/home/multidata"), axios.get("http://123.207.32.32:9001/lyric?id=50066 阅读全文
posted @ 2022-08-29 11:51 杨建鑫 阅读(187) 评论(0) 推荐(0) 编辑
摘要: // 1.发送get请求 axios.get(`http://123.207.32.32:9001/lyric?id=500665346`).then(res => { console.log("res:", res.data.lrc) }) axios.get("http://123.207.32 阅读全文
posted @ 2022-08-29 11:35 杨建鑫 阅读(69) 评论(0) 推荐(0) 编辑
摘要: 1.特点 : 1.在浏览器中发送 XMLHttpRequest 请求 2.在node.js 中发送 http 请求 3.支持Promise API 4.拦截请求和响应 2.支持多种请求方式: axios(config) axios.request(config) axios.get(url[, co 阅读全文
posted @ 2022-08-29 11:08 杨建鑫 阅读(164) 评论(0) 推荐(0) 编辑