随笔分类 -  codewhy模块

摘要:<template> <div class="app"> <h3> 在模板中直接使用(vue2-3都可用) </h3> 姓名 : {{ $store.state.nameVuex }} 等级 : {{ $store.state.levelVuex }} 头像 : {{ $store.state.av 阅读全文
posted @ 2022-08-29 16:17 杨建鑫 阅读(343) 评论(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 杨建鑫 阅读(205) 评论(0) 推荐(0)
摘要:// 对实例配置拦截器 // 请求拦截器 - 参数1:成功(一般参数叫config) 参数2:失败 axios.interceptors.request.use((config) => { console.log("请求成功的拦截") // 1.开始loading的动画 // 2.对原来的配置进行一 阅读全文
posted @ 2022-08-29 12:08 杨建鑫 阅读(50) 评论(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 杨建鑫 阅读(231) 评论(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 杨建鑫 阅读(192) 评论(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 杨建鑫 阅读(80) 评论(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 杨建鑫 阅读(207) 评论(0) 推荐(0)
摘要:import { useRouter } from 'vue-router' const router = useRouter() router.push({ path: "/about", query: { name: "why", age: 18 } }) 如何得到query呢 ? 模板中 : 阅读全文
posted @ 2022-08-25 15:50 杨建鑫 阅读(25) 评论(0) 推荐(0)
摘要:在路由配置里面,路径后面加 /:值 ,那么路径就会有了参数 例子 : { name:'home', path:'/home/:abc', component:Home } <router-link to="/home/875">Home</router-link> <router-link to=" 阅读全文
posted @ 2022-08-25 15:29 杨建鑫 阅读(40) 评论(0) 推荐(0)
摘要:1.路由里面的 redirect 重定向 redirect 重定向 : 把 '/' 直接定到 '/home' 去 {path:'/',redirect:'/home'}, // redirect 重定向 : 把 '/' 直接定到 '/home' 去 {path:'/',redirect:'/home 阅读全文
posted @ 2022-08-25 15:28 杨建鑫 阅读(258) 评论(0) 推荐(0)
摘要:<template> <div>AppContent: {{ message }}</div> <button @click="changeMessage">修改message</button> <showInfo name="why" :age="18" @info-btn-click="info 阅读全文
posted @ 2022-08-24 17:26 杨建鑫 阅读(46) 评论(0) 推荐(0)
摘要:<template> <div> <h2>当前计数: {{ counter }}</h2> <button @click="counter++">+1</button> <button @click="name = 'kobe'">修改name</button> </div> </template> 阅读全文
posted @ 2022-08-24 16:11 杨建鑫 阅读(70) 评论(0) 推荐(0)
摘要:<template> <div> 本人 : {{reactiveWatch.name}} - {{reactiveWatch.age}} 朋友 : {{reactiveWatch.firend.name}} 同桌 : {{reactiveWatch.firend.hang.name1}} - {{r 阅读全文
posted @ 2022-08-24 15:53 杨建鑫 阅读(37) 评论(0) 推荐(0)
摘要:<template> <div> 本人 : {{refWatch.name}} - {{refWatch.age}} 朋友 : {{refWatch.firend.name}} 同桌 : {{refWatch.firend.hang.name1}} - {{refWatch.firend.hang. 阅读全文
posted @ 2022-08-24 15:51 杨建鑫 阅读(249) 评论(0) 推荐(0)
摘要:<template> <div> {{refWatch}} <button @click="refWatch++">ref的变化</button> </div> </template> <script> import {ref,reactive,watch} from 'vue' export de 阅读全文
posted @ 2022-08-24 15:43 杨建鑫 阅读(287) 评论(0) 推荐(0)
摘要:父组件 : <template> <div>AppContent: {{ name }}</div> <button @click="name = 'kobe'">app btn</button> <show-info></show-info> </template> <script> import 阅读全文
posted @ 2022-08-24 15:04 杨建鑫 阅读(18) 评论(0) 推荐(0)
摘要:父组件 : <template> <div> <div class="name" ref="oneRef"> ref第一个 </div> <div class="name" ref="twoRef"> ref第2个 </div> <hello ref="ziRef"></hello> </div> 阅读全文
posted @ 2022-08-24 14:50 杨建鑫 阅读(172) 评论(0) 推荐(0)
摘要:<template> <div> <input type="number" v-model="num1"> + <input type="number" v-model="num2"> 答案 : {{total}} <hr> <input type="text" v-model="name1"> < 阅读全文
posted @ 2022-08-24 14:10 杨建鑫 阅读(25) 评论(0) 推荐(0)
摘要:<template> <div> 默认 : {{data.name}} - {{data.age}} - {{data.hight}} <br> 解构 : {{name}} - {{age}} - {{hight}} <br> <button @click="age++,hight++">改变</b 阅读全文
posted @ 2022-08-24 13:30 杨建鑫 阅读(80) 评论(0) 推荐(0)
摘要:父组件 : <template> <div> 父组件 : {{data.name}} - {{data.age}} - {{data.hight}} <hr> <Hello :data="data" :readonlyData="readonlyData" @readonlyChange="read 阅读全文
posted @ 2022-08-24 11:50 杨建鑫 阅读(27) 评论(0) 推荐(0)