From bb773f8f48fe36b7da171793c5ca067c9c95467a Mon Sep 17 00:00:00 2001 From: fxy060608 Date: Wed, 30 Oct 2019 13:51:33 +0800 Subject: [PATCH] feat(v3): add uni-view-update --- .../app-plus/view/framework/plugins/data.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/platforms/app-plus/view/framework/plugins/data.js b/src/platforms/app-plus/view/framework/plugins/data.js index d0a8d837c..e8efc2663 100644 --- a/src/platforms/app-plus/view/framework/plugins/data.js +++ b/src/platforms/app-plus/view/framework/plugins/data.js @@ -69,6 +69,19 @@ function broadcast (vm, componentName, eventName, ...params) { }) } +const NATIVE_COMPONENTS = ['Camera', 'LivePlayer', 'LivePusher', 'Map', 'Video'] + +function updateView () { + const pages = getCurrentPages() + pages.length && broadcast( + pages[0].$vm, + NATIVE_COMPONENTS, + 'uni-view-update' + ) +} + +window.addEventListener('resize', updateView) + function vdSync ({ data, options @@ -82,11 +95,7 @@ function vdSync ({ }) vd.flush() Vue.nextTick(() => { - broadcast( - getCurrentPages()[0].$vm, - ['Camera', 'LivePlayer', 'LivePusher', 'Map', 'Video'], - 'uni-view-update' - ) + updateView() isVdCallback && UniViewJSBridge.publishHandler(VD_SYNC_CALLBACK) }) } -- GitLab