提交 14a8d414 编写于 作者: 雪洛's avatar 雪洛

fix: globalPropertiesFn箭头函数内不可使用this

上级 8e1ace06
...@@ -19,8 +19,8 @@ export function createApp() { ...@@ -19,8 +19,8 @@ export function createApp() {
str: 'default reactive string', str: 'default reactive string',
num: 0, num: 0,
bool: false, bool: false,
}) } as UTSJSONObject)
app.config.globalProperties.globalPropertiesFn = () : string => { app.config.globalProperties.globalPropertiesFn = function () : string {
console.log('this.globalPropertiesStr', this.globalPropertiesStr) console.log('this.globalPropertiesStr', this.globalPropertiesStr)
console.log('this.globalPropertiesNum', this.globalPropertiesNum) console.log('this.globalPropertiesNum', this.globalPropertiesNum)
return `globalPropertiesStr: ${this.globalPropertiesStr}, globalPropertiesNum: ${this.globalPropertiesNum}` return `globalPropertiesStr: ${this.globalPropertiesStr}, globalPropertiesNum: ${this.globalPropertiesNum}`
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册