我有一个变量,它看起来像这样:我要如何插入一个换行符在文云如何使用KineticJS在JavaScript变量内添加换行符?
var simpleText = new Kinetic.Text({
text: 'where text goes',
fontSize: 24
});
。我试过了:
text: 'where text goes \n where text goes',
text: 'where text goes \n\n where text goes',
text: 'where text goes \r\n where text goes',
text: 'where text goes <br /> where text goes',
text: 'where text goes \n' + 'where text goes \n',
text: 'where text goes ' + 'where text goes ',
text: 'where text goes '
+ 'where text goes ',
text: 'where text goes
where text goes',
我的错误。 \ n作品
它可能输出HTML,所以使用'
'而不是'\ n'。否则,你的第一个例子应该工作。 – Ian
感谢您的建议,但不起作用,它不会输出html。另外,当我使用\ n它根本不输出任何文本。 – user761479
您是否在使用此图书馆?:https://github.com/ericdrowell/KineticJS – Ian