流星辅助变量去除重复的相邻空格
Meteor helper variable removes duplicate adjacent spaces
我对模板中的 Meteor 辅助变量有疑问。
<div id="window"> {{ string }} </div>
CSS:
#window {
height: 450px;
overflow: auto;
word-wrap: break-word;
white-space: pre-wrap;
}
我正在从文件中读取文本。
如果我在 JavaScript 中设置辅助变量,例如:
Template.oreo.helpers({
string: function() {
return 'Here is sentence. After which is spaces that is being replaced by one. '
}
});
多个字符串将被单个字符串替换space..
当我使用JQuery设置文本时下注:
$('#window').text('Here is multiple spaces.');
不会出现这个问题。
我该如何解决这个问题?将文本保存在辅助字符串中非常重要,否则我将不得不重写所有脚本。
您确定您没有在浏览器中显示之前不小心修剪字符串吗?
我对模板中的 Meteor 辅助变量有疑问。
<div id="window"> {{ string }} </div>
CSS:
#window {
height: 450px;
overflow: auto;
word-wrap: break-word;
white-space: pre-wrap;
}
我正在从文件中读取文本。
如果我在 JavaScript 中设置辅助变量,例如:
Template.oreo.helpers({
string: function() {
return 'Here is sentence. After which is spaces that is being replaced by one. '
}
});
多个字符串将被单个字符串替换space..
当我使用JQuery设置文本时下注:
$('#window').text('Here is multiple spaces.');
不会出现这个问题。
我该如何解决这个问题?将文本保存在辅助字符串中非常重要,否则我将不得不重写所有脚本。
您确定您没有在浏览器中显示之前不小心修剪字符串吗?