From ecf6b8226c006464855911d6fc38cd015e2c9e0a Mon Sep 17 00:00:00 2001 From: qiang Date: Tue, 26 Feb 2019 19:15:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20titleNView=E6=94=AF=E6=8C=81searchInput?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/helpers/patch.js | 14 +- src/core/service/bridge/on.js | 6 +- src/platforms/h5/components/page/pageHead.vue | 158 ++++++++++++++++-- 3 files changed, 162 insertions(+), 16 deletions(-) diff --git a/src/core/helpers/patch.js b/src/core/helpers/patch.js index be27fca827..41b3eb9c3c 100644 --- a/src/core/helpers/patch.js +++ b/src/core/helpers/patch.js @@ -34,6 +34,18 @@ export function mergeTitleNView (navigationBar, titleNView) { if (hasOwn(titleNView, 'type')) { navigationBar.type = titleNView.type } + if (hasOwn(titleNView, 'searchInput') && typeof titleNView.searchInput === 'object') { + navigationBar.searchInput = Object.assign({ + autoFocus: false, + align: 'center', + color: '#000000', + backgroundColor: 'rgba(255,255,255,0.5)', + borderRadius: '0px', + placeholder: '', + placeholderColor: '#CCCCCC', + disabled: false + }, titleNView.searchInput) + } } return navigationBar -} +} diff --git a/src/core/service/bridge/on.js b/src/core/service/bridge/on.js index cf99847dfa..1ca4f1ac63 100644 --- a/src/core/service/bridge/on.js +++ b/src/core/service/bridge/on.js @@ -69,5 +69,9 @@ export default function initOn (on) { on('onTabItemTap', createCallCurrentPageHook('onTabItemTap')) on('onNavigationBarButtonTap', createCallCurrentPageHook('onNavigationBarButtonTap')) + on('onNavigationBarSearchInputChanged', createCallCurrentPageHook('onNavigationBarSearchInputChanged')) + on('onNavigationBarSearchInputConfirmed', createCallCurrentPageHook('onNavigationBarSearchInputConfirmed')) + on('onNavigationBarSearchInputClicked', createCallCurrentPageHook('onNavigationBarSearchInputClicked')) + on('onWebInvokeAppService', onWebInvokeAppService) -} +} diff --git a/src/platforms/h5/components/page/pageHead.vue b/src/platforms/h5/components/page/pageHead.vue index ece51bb1b7..a2fc969145 100644 --- a/src/platforms/h5/components/page/pageHead.vue +++ b/src/platforms/h5/components/page/pageHead.vue @@ -3,13 +3,16 @@
+ class="uni-page-head" + >
-
+
+ class="uni-btn-icon"> +
-
+
+ class="uni-page-head__title" + > + class="uni-loading"/> {{ titleText }}
+
+ class="uni-placeholder"/>