Tencent / wepy

小程序组件化开发框架
https://wepyjs.gitee.io/wepy-docs/
Other
22.48k stars 3.05k forks source link

wepy.page实例中无法访问到wepy.app实例的customFunction #1718

Closed sponialdy closed 5 years ago

sponialdy commented 5 years ago

Description

wepy.page实例中无法访问到wepy.app实例的customFunction

Environment

Reproduce

see Relevant Code

Observed Results

只能读取customData

Expected Results

可以读取到customFunction和customData

Relevant Code / Logs

// app实例
export default class extends wepy.app {
  constructor() {
    super();
    this.use('promisify');
  }

  globalData = {};

  config = {};

  customData = {};

  customFunction() {};

  onLaunch() {};
}

// page 实例
export default class Activity extends wepy.page {
  config = {};
  data = {};
  onLoad(query) {
    console.log(this.$parent);
   // 无法读取到customFunction, 可以读取到customData
  }
}
stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. 因为这个 Issue 最近没有任何有效回复,所以被自动标记为了stale。 如果在未来7天依旧没有任何激活操作,那么该 Issue 将会被自动关闭。 感谢您的提问。