How to read JS file app.ux Global variables in

Fast application definition in app.ux The global variables in the JS file can be obtained through the quick application of the public method getapp (). For details, please refer to the following example code.

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

Quick application script:

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


Link to the original text: https://developer.huawei.com/consumer/cn/forum/topic/0204411133432620361?fid=18

Original author: mayism

Read More: