Explorar o código

replaseAll bug处理

zhengkaixin %!s(int64=2) %!d(string=hai) anos
pai
achega
45c19b54ee
Modificáronse 1 ficheiros con 10 adicións e 1 borrados
  1. 10 1
      pages/article/articleDetails.vue

+ 10 - 1
pages/article/articleDetails.vue

@@ -52,8 +52,17 @@
 					this.newsDetail = res.data;
 					
 					if(this.elderStatus) {
+					
 						this.myFontSize=16;
-						this.newsDetail.content=this.newsDetail.content.replaceAll("font-size","font-size:"+this.myFontSize+"px;");
+						
+						var key1="font-size"
+						var key2="font-size:"+this.myFontSize+"px  ; "
+						
+						var reg=new RegExp(key1,'gi')
+						var content=this.newsDetail.content.replace(reg,key2)
+						
+						this.newsDetail.content=content;
+												
 					}