app.wpy 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <script>
  2. import wepy from '@wepy/core';
  3. // import eventHub from './common/eventHub';
  4. import vuex from '@wepy/x';
  5. wepy.use(vuex);
  6. wepy.app({
  7. hooks: {
  8. // App 级别 hook,对整个 App 生效
  9. // 同时存在 Page hook 和 App hook 时,优先执行 Page hook,返回值再交由 App hook 处
  10. // 'before-setData': function (dirty) {
  11. // console.log('setData dirty: ', dirty);
  12. // return dirty;
  13. // }
  14. },
  15. globalData: {
  16. appInfo: 'this is globleData',
  17. userInfo: null
  18. },
  19. onLaunch() {
  20. console.log('app onLaunch');
  21. // this.testAsync();
  22. // eventHub.$on('app-launch', (...args) => {
  23. // console.log('app-launch event emitted, the params are:');
  24. // console.log(args);
  25. // });
  26. },
  27. onShow () {
  28. console.log('app onishow');
  29. }
  30. // methods: {
  31. // sleep (s) {
  32. // return new Promise((resolve, reject) => {
  33. // setTimeout(() => {
  34. // resolve('promise resolved')
  35. // }, s * 1000)
  36. // })
  37. // },
  38. // async testAsync () {
  39. // let d = await this.sleep(3);
  40. // console.log(d);
  41. // }
  42. // }
  43. });
  44. </script>
  45. <config>
  46. {
  47. "entryPagePath": "pages/index",
  48. requiredPrivateInfos: ["getLocation"],
  49. pages: [
  50. 'pages/index',
  51. 'pages/login',
  52. 'pages/report/index',
  53. 'pages/my/index'
  54. ],
  55. window: {
  56. backgroundTextStyle: 'light',
  57. navigationBarBackgroundColor: '#fff',
  58. navigationBarTitleText: 'ITT健康检测',
  59. navigationBarTextStyle: 'black'
  60. },
  61. tabBar: {
  62. list:[
  63. {
  64. pagePath: 'pages/index',
  65. text: '首页'
  66. },
  67. {
  68. pagePath: 'pages/report/index',
  69. text: '报告'
  70. },
  71. {
  72. pagePath: 'pages/my/index',
  73. text: '我的'
  74. }
  75. ]
  76. }
  77. }
  78. </config>