* [html5] ref in v-if is a array.
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/a38e2899 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/a38e2899 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/a38e2899 Branch: refs/heads/0.12-dev Commit: a38e28998d411959ae03dd53f77c413ee100a709 Parents: 8cd9157 Author: MrRaindrop <tekk...@gmail.com> Authored: Tue Apr 18 18:52:49 2017 +0800 Committer: MrRaindrop <tekk...@gmail.com> Committed: Tue Apr 18 18:52:49 2017 +0800 ---------------------------------------------------------------------- html5/render/vue/modules/animation.js | 16 +++++++++++++++- html5/render/vue/modules/dom.js | 16 +++++++++++++++- html5/render/vue/modules/webview.js | 20 +++++++++++++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a38e2899/html5/render/vue/modules/animation.js ---------------------------------------------------------------------- diff --git a/html5/render/vue/modules/animation.js b/html5/render/vue/modules/animation.js index a294896..07542bb 100644 --- a/html5/render/vue/modules/animation.js +++ b/html5/render/vue/modules/animation.js @@ -16,9 +16,23 @@ * specific language governing permissions and limitations * under the License. */ -import { nextFrame, toCSSText, autoPrefix, camelizeKeys, normalizeStyle } from '../utils' +import { + nextFrame, + toCSSText, + autoPrefix, + camelizeKeys, + normalizeStyle, + isArray +} from '../utils' function transitionOnce (vnode, config, callback) { + if (isArray(vnode)) { + if (process.env.NODE_ENV === 'development') { + console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.') + } + vnode = vnode[0] + } + const duration = config.duration || 0 // ms const timing = config.timingFunction || 'linear' const delay = config.delay || 0 // ms http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a38e2899/html5/render/vue/modules/dom.js ---------------------------------------------------------------------- diff --git a/html5/render/vue/modules/dom.js b/html5/render/vue/modules/dom.js index 61f30dd..117eaeb 100644 --- a/html5/render/vue/modules/dom.js +++ b/html5/render/vue/modules/dom.js @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { camelToKebab, appendCss } from '../utils' +import { camelToKebab, appendCss, isArray } from '../utils' function getParentScroller (vnode) { if (!vnode) return null @@ -83,6 +83,13 @@ export default { * ps: scroll-to has 'ease' and 'duration'(ms) as options. */ scrollToElement: function (vnode, options) { + if (isArray(vnode)) { + if (process.env.NODE_ENV === 'development') { + console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.') + } + vnode = vnode[0] + } + const scroller = getParentScroller(vnode) const scrollDirection = scroller.scrollDirection || 'vertical' @@ -126,6 +133,13 @@ export default { * @param {Function} callback */ getComponentRect: function (vnode, callback) { + if (isArray(vnode)) { + if (process.env.NODE_ENV === 'development') { + console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.') + } + vnode = vnode[0] + } + const info = { result: false } if (vnode && vnode === 'viewport') { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/a38e2899/html5/render/vue/modules/webview.js ---------------------------------------------------------------------- diff --git a/html5/render/vue/modules/webview.js b/html5/render/vue/modules/webview.js index b5bfe9f..f4aec49 100644 --- a/html5/render/vue/modules/webview.js +++ b/html5/render/vue/modules/webview.js @@ -20,19 +20,37 @@ /** * Webview module */ - +import { isArray } from '../utils' export default { goBack (vnode) { + if (isArray(vnode)) { + if (process.env.NODE_ENV === 'development') { + console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.') + } + vnode = vnode[0] + } if (vnode && typeof vnode.goBack === 'function') { vnode.goBack() } }, goForward (vnode) { + if (isArray(vnode)) { + if (process.env.NODE_ENV === 'development') { + console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.') + } + vnode = vnode[0] + } if (vnode && typeof vnode.goForward === 'function') { vnode.goForward() } }, reload (vnode) { + if (isArray(vnode)) { + if (process.env.NODE_ENV === 'development') { + console.warn('[vue-render] the ref passed to animation.transitionOnce is a array.') + } + vnode = vnode[0] + } if (vnode && typeof vnode.reload === 'function') { vnode.reload() }