字符串去掉空白时,空格不去掉。
This commit is contained in:
parent
ea238cd407
commit
82779c99ea
|
@ -1453,7 +1453,7 @@ function description_showwords_ellipsis(id,num){
|
|||
});
|
||||
|
||||
//去掉空格
|
||||
str = str.replace(/\s/gi,'');
|
||||
str = str.replace(/[\f\n\r\t\v]/gi,'');
|
||||
|
||||
if(str.length > num){
|
||||
str = str.substring(0,num)+"...";
|
||||
|
|
|
@ -247,11 +247,11 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$loc
|
|||
|
||||
var desc = ""
|
||||
if(response.data.data.content){
|
||||
desc = response.data.data.content.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/ /g,"");
|
||||
desc = response.data.data.content.replace(/<[^>]+>/gi,"").replace(/[\f\n\r\t\v]/gi,"").replace(/ /gi,"");
|
||||
}
|
||||
|
||||
if(response.data.data.description){
|
||||
desc = response.data.data.description.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/ /g,"");
|
||||
desc = response.data.data.description.replace(/<[^>]+>/gi,"").replace(/[\f\n\r\t\v]/gi,"").replace(/ /gi,"");
|
||||
}
|
||||
|
||||
if(desc.length > 30){
|
||||
|
|
Loading…
Reference in New Issue