From 569d3334290a2025abee40227a14c5bdb463d078 Mon Sep 17 00:00:00 2001 From: MrRaindrop Date: Thu, 15 Jun 2017 12:04:59 +0800 Subject: [PATCH] * [html5] fix indicator & slider when there's no children. --- html5/render/vue/components/slider/indicator.js | 8 +------- html5/render/vue/components/slider/slideMixin.js | 11 +++++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/html5/render/vue/components/slider/indicator.js b/html5/render/vue/components/slider/indicator.js index 09189bb61c..e38bd6c715 100644 --- a/html5/render/vue/components/slider/indicator.js +++ b/html5/render/vue/components/slider/indicator.js @@ -58,9 +58,6 @@ function getIndicatorItemStyle (spec, isActive) { function _render (context, h) { const children = [] const mergedStyle = extractComponentStyle(context) - // const mergedStyle = context._getComponentStyle(context.$vnode.data) - // context.$vnode.data.cached = {} - // extendKeys(context.$vnode.data.cached, mergedStyle, ['width', 'height']) const indicatorSpecStyle = extendKeys( {}, mergedStyle, @@ -173,14 +170,11 @@ export default { active: 0 } }, - // props: { - // count: [Number, String], - // active: [Number, String] - // }, render (createElement) { const { count, active } = this.$vnode.data.attrs || {} this.count = count this.active = active + if (!this.count) { return } this._renderHook() return _render(this, createElement) }, diff --git a/html5/render/vue/components/slider/slideMixin.js b/html5/render/vue/components/slider/slideMixin.js index 84ca705326..da2c8480ae 100644 --- a/html5/render/vue/components/slider/slideMixin.js +++ b/html5/render/vue/components/slider/slideMixin.js @@ -52,10 +52,13 @@ export default { const children = this.$children const len = children && children.length if (children && len > 0) { - const indicator = children[len - 1] - if (indicator.$options._componentTag === 'indicator' - || indicator.$vnode.data.ref === 'indicator') { - indicator._watcher.get() + for (let i = 0; i < len; i++) { + const vm = children[i] + if (vm.$options._componentTag === 'indicator' + || vm.$vnode.data.ref === 'indicator') { + vm._watcher.get() + break + } } } fireLazyload(this.$el, true)