提交 9c25c667 编写于 作者: Q qiang

fix: 解决 swiper 组件某些情况下渲染错误的问题 (question/89853)

上级 a6fbb25e
......@@ -2,6 +2,24 @@
<script>
import touchtrack from 'uni-mixins/touchtrack'
function deepClone (vnodes, createElement) {
function cloneVNode (vnode) {
var clonedChildren = vnode.children && vnode.children.map(cloneVNode)
var cloned = createElement(vnode.tag, vnode.data, clonedChildren)
cloned.text = vnode.text
cloned.isComment = vnode.isComment
cloned.componentOptions = vnode.componentOptions
cloned.elm = vnode.elm
cloned.context = vnode.context
cloned.ns = vnode.ns
cloned.isStatic = vnode.isStatic
cloned.key = vnode.key
return cloned
}
return vnodes.map(cloneVNode)
}
export default {
name: 'Swiper',
mixins: [touchtrack],
......@@ -587,7 +605,7 @@ export default {
var slidesDots = []
var swiperItems = []
if (this.$slots.default) {
this.$slots.default.forEach(vnode => {
deepClone(this.$slots.default, createElement).forEach(vnode => {
if (vnode.componentOptions && vnode.componentOptions.tag === 'v-uni-swiper-item') {
swiperItems.push(vnode)
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册