@dcloudio/uni-app-plus 3.0.0-alpha-3040020220301003 → 3.0.0-alpha-3040020220304001

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -718,6 +718,7 @@ var serviceContext = (function (vue) {
718
718
  const createVueAppHooks = [];
719
719
  /**
720
720
  * 提供 createApp 的回调事件,方便三方插件接收 App 对象,处理挂靠全局 mixin 之类的逻辑
721
+ * @param hook
721
722
  */
722
723
  function onCreateVueApp(hook) {
723
724
  // TODO 每个 nvue 页面都会触发
@@ -15962,14 +15963,10 @@ var serviceContext = (function (vue) {
15962
15963
  errCode: err.code,
15963
15964
  });
15964
15965
  });
15965
- // @ts-expect-error
15966
- audio.addEventListener('prev', () => {
15967
- onBackgroundAudioStateChange({ state: 'prev' });
15968
- });
15969
- // @ts-expect-error
15970
- audio.addEventListener('next', () => {
15971
- onBackgroundAudioStateChange({ state: 'next' });
15972
- });
15966
+ // @ts-ignore
15967
+ audio.addEventListener('prev', () => publish('onBackgroundAudioPrev'));
15968
+ // @ts-ignore
15969
+ audio.addEventListener('next', () => publish('onBackgroundAudioNext'));
15973
15970
  }
15974
15971
  function getBackgroundAudioState() {
15975
15972
  let data = {
@@ -16058,7 +16055,7 @@ var serviceContext = (function (vue) {
16058
16055
  }
16059
16056
  function onBackgroundAudioStateChange({ state, errMsg, errCode, dataUrl, }) {
16060
16057
  callbacks[state].forEach((callback) => {
16061
- if (isFunction(callback)) {
16058
+ if (typeof callback === 'function') {
16062
16059
  callback(state === 'error'
16063
16060
  ? {
16064
16061
  errMsg,
@@ -17288,10 +17285,7 @@ var serviceContext = (function (vue) {
17288
17285
  }
17289
17286
  function initHooks(options, instance, publicThis) {
17290
17287
  const mpType = options.mpType || publicThis.$mpType;
17291
- if (!mpType) {
17292
- // 仅 App,Page 类型支持在 options 中配置 on 生命周期,组件可以使用组合式 API 定义页面生命周期
17293
- return;
17294
- }
17288
+ // 为了组件也可以监听部分生命周期,故不再判断mpType,统一添加on开头的生命周期
17295
17289
  Object.keys(options).forEach((name) => {
17296
17290
  if (name.indexOf('on') === 0) {
17297
17291
  const hooks = options[name];