How to read global variables in app.ux in js file

The global variables defined in app.ux can be obtained through the public method getApp() of fast app in the js file. For details, please refer to the sample code below.

app.ux code:

data: {
      AppData: '123456',
}

Js file:

export default {
      getAppData() {
        return getApp().$def.data.AppData
      }
    }

For more details, please refer to:

Quick application development guidance document:https://developer.huawei.com/consumer/cn/doc/development/quickApp-Guides/quickapp-whitepaper

Quickly apply the script script:

https://developer.huawei.com/consumer/cn/doc/development/quickApp-References/quickapp-script


Original link:https://developer.huawei.com/consumer/cn/forum/topic/0204411133432620361?fid=18

Author: Mayism

Guess you like

Origin blog.51cto.com/14772288/2675980