自己做vue实的一些小问题

Cannot read property 'replace' of undefined"


Cannot read property 'replace' of undefined" 

说明你要设置的变量是null值,你加个判断,如果变量是null,那么···,不是null的话···


JS替换空格回车换行符


str=str.replace(/\r/g," ")
str=str.replace(/\n/g,"<br />") 
 或 

str=str.replaceAll("  ","")

指令和过滤器函数

如题。我想在v-html后面使用一个过滤器,代码如下:

<div class="detail" v-html="article | replaceUrl"></div>

但是我发现在Vue2中不能用了,只能在{{}}中过滤,但是{{}}又不能绑定html

v-html="replaceMethod(article)"

keep-alive

https://segmentfault.com/a/1190000008123035

posted @ 2017-10-09 11:56  金于虎  阅读(576)  评论(0编辑  收藏  举报