js基础问题


如图,我在about页面内写两句话,主要就是想通过{{}}调用msg变量 然后在屏幕上面显示其内容“Hello World”,是在.wxml和.js里面各添加一句这样的话吗?
<text>{{msg}}</text>
this.setData({ msg: ‘Hello World’ })
但是为什么提示错误呢?是我添加的位置不对吗?我应该怎么添加呢?
如图,我在about页面内写两句话,主要就是想通过{{}}调用msg变量 然后在屏幕上面显示其内容“Hello World”,是在.wxml和.js里面各添加一句这样的话吗?
<text>{{msg}}</text>
this.setData({ msg: ‘Hello World’ })
但是为什么提示错误呢?是我添加的位置不对吗?我应该怎么添加呢?