提交 ce61aa68 编写于 作者: D DCloud_LXH

fix(App): picker-view

上级 4f9d0f00
...@@ -105,15 +105,18 @@ export default /*#__PURE__*/ defineBuiltInComponent({ ...@@ -105,15 +105,18 @@ export default /*#__PURE__*/ defineBuiltInComponent({
onMounted(onMountedCallback) onMounted(onMountedCallback)
} }
let ColumnsPreRef: Ref<VNode[]> = ref([]) let ColumnsPreRef: Ref<VNode[]> = ref([])
// app HTMLCollection, H5 VNode[]
let columnsRef: Ref<VNode[] | HTMLCollection> = ref([]) let columnsRef: Ref<VNode[] | HTMLCollection> = ref([])
function getItemIndex(vnode: VNode): number { function getItemIndex(vnode: VNode): number {
const columnVNodes = (columnsRef.value as VNode[]).filter( let columnVNodes = columnsRef.value
(ref) => typeof ref.type !== 'symbol' if (__PLATFORM__ === 'app' && columnVNodes instanceof HTMLCollection) {
)
if (__PLATFORM__ === 'app' && columnVNodes) {
return Array.prototype.indexOf.call(columnVNodes, vnode.el) return Array.prototype.indexOf.call(columnVNodes, vnode.el)
} else {
columnVNodes = (columnVNodes as VNode[]).filter(
(ref) => typeof ref.type !== 'symbol'
)
} }
let index: number = columnVNodes.indexOf(vnode) let index: number = (columnVNodes as VNode[]).indexOf(vnode)
return index !== -1 ? index : ColumnsPreRef.value.indexOf(vnode) return index !== -1 ? index : ColumnsPreRef.value.indexOf(vnode)
} }
const getPickerViewColumn: GetPickerViewColumn = function (columnInstance) { const getPickerViewColumn: GetPickerViewColumn = function (columnInstance) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册