![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue
努力努力再努力c.
红红火火恍恍惚惚
展开
-
let和var两个关键字的区别
let和var的区别原创 2021-08-29 18:29:32 · 1543 阅读 · 0 评论 -
Vue路由跳转(返回上一页以及返回到指定页面)
1,自动返回上一页methods:{ goback();},goback(){ this.$router.go(-1) }2,自动跳转到指定页面methods:{ ToSkip();},ToSkip(){ this.$router.push('/skip') } //最常用的或者ToSkip(){ this.$router.push({name:'skip'}) }//采用对象的方法...原创 2021-08-29 18:19:52 · 10117 阅读 · 0 评论 -
Vue中this.$route.query和this.$route.params的表现区别
http://localhost:3000/edit/123如果是这种的URL就需要使用this.$route.params.idhttp://localhost:3000?token=ajdfyuafduyagddsa如果是这种的URL就需要使用this.$route.query原创 2021-08-29 18:05:29 · 262 阅读 · 0 评论 -
Vue中this.$route.query和this.$route.params的使用
一、this.$route.query的使用1、router/index.js{ path:'/mtindex', component: mtindex, //添加路由 children:[ { path:':shopid', component:guessdetail } ] },2、传参this.$router.push({ path: '/mtindex/detail', query:{shopid: item.id}原创 2021-08-29 18:02:52 · 1027 阅读 · 0 评论 -
Vue路由参数改变后没有重新刷新页面的解决方法
方法一:beforeRouteUpdate (to, from, next) { this.lang = to.params.lang; this.setCode(); next();}方法二:<router-view :key="$route.fullPath" />方法三:在页面里监听路由变化wathch:{ $route:function(newVal,oldVal){ }}方法四:window 的hashchange事件window.ad原创 2021-08-29 17:56:45 · 766 阅读 · 0 评论 -
过滤html标签及截取字符串
今天做了一个根据文章内容自动获取文章摘要的功能,但是在点击自动获取文章摘要的按钮后,发现获取的文章摘要里出现了许多html的标签,于是自己就去查询了一下如何解决此类问题的方法,发现十分简单,即利用了下面这个方法来过滤掉所有html的标签:.replace(/<.*?>/g,"")这样,便完美的把所有文章内容中存在的html标签全给过滤掉了同时,又利用了下面这个方法来实现了限制自动获取内容摘要的字符个数的功能:.substring(0,150) //自动截取文章内容前150个字这原创 2021-08-20 21:35:37 · 419 阅读 · 0 评论