@@ -43,7 +43,7 @@ export default {
4343 </script >
4444<script lang="ts" setup>
4545import { getCurrentInstance , ref , watch , nextTick } from ' vue'
46- import { deepClone , getType , isArray , isEqual , range } from ' ../common/util'
46+ import { deepClone , getType , isArray , isEqual , isFunction , range } from ' ../common/util'
4747import { formatArray , pickerViewProps , type PickerViewExpose } from ' ./types'
4848
4949const props = defineProps (pickerViewProps )
@@ -53,6 +53,7 @@ const formatColumns = ref<Record<string, string>[][]>([])
5353const itemHeight = ref <number >(35 )
5454const selectedIndex = ref <Array <number >>([]) // 格式化之后,每列选中的下标集合
5555const preSelectedIndex = ref <Array <number >>([])
56+ const emit = defineEmits ([' change' , ' pickstart' , ' pickend' , ' update:modelValue' ])
5657
5758watch (
5859 () => props .modelValue ,
@@ -103,7 +104,7 @@ watch(
103104watch (
104105 () => props .columnChange ,
105106 (newValue ) => {
106- if (newValue && getType (newValue ) !== ' function ' ) {
107+ if (newValue && ! isFunction (newValue )) {
107108 console .error (' The type of columnChange must be Function' )
108109 }
109110 },
@@ -114,8 +115,6 @@ watch(
114115)
115116const { proxy } = getCurrentInstance () as any
116117
117- const emit = defineEmits ([' change' , ' pickstart' , ' pickend' , ' update:modelValue' ])
118-
119118/**
120119 * @description 根据传入的value,寻找对应的索引,并传递给原生选择器。
121120 * 会保证formatColumns先设置,之后会修改selectedIndex。
0 commit comments