2021年9月17日

Vue watch 监听 computed

摘要: computed 的英文意思是计算,那么顾名思义,vue中的computed也与计算有关,他是专门用来处理复杂表达式的,在vue中,不建议在模板语法中写复杂的表达式,如:x+y+(z-1) 这种,所以vue建了一个computed用来处理这类表达式,使用方法其实也不难,在computed里面建一个函 阅读全文

posted @ 2021-09-17 16:29 左侧岚 阅读(680) 评论(0) 推荐(0) 编辑

vue 路由跳转,参数消失问题

摘要: vue 路由跳转,参数消失问题 1. 参数传递页面:这种方式页面刷新参数丢失。 // 点击跳转详情页面 toDetail(){ this.$router.push({ name:"newsDetail", params:{content:item}//传递过去的参数 }) } 页面取参数 :this 阅读全文

posted @ 2021-09-17 15:33 左侧岚 阅读(1068) 评论(0) 推荐(0) 编辑

vue 使用:class切换高亮 点击路由跳转 上个组件的点击事件保存的参数 在下一次重复进入这个组件的时候 默认值都已经还原了 得通过路由跳转的时候 把上个组件的状态通过路由保存下来 通过下一次进入这个组件的时候 获取路由 渲染当前页面的:class 进行高亮

摘要: 第2种方式 通过组件库属性直接操作 <div class="nav"> <router-link :to="item.path" v-for="(item, index) in navData" :key="index" >{{ item.name }}11</router-link> </div> 阅读全文

posted @ 2021-09-17 15:23 左侧岚 阅读(102) 评论(0) 推荐(0) 编辑

导航