Skip to content

Commit 2102f38

Browse files
author
xuqingkai
committed
fix: 🐛 修复picker-view初始化报错的问题
Closes: #205
1 parent c8d9d26 commit 2102f38

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/uni_modules/wot-design-uni/components/wd-picker-view/wd-picker-view.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export default {
4343
</script>
4444
<script lang="ts" setup>
4545
import { 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'
4747
import { formatArray, pickerViewProps, type PickerViewExpose } from './types'
4848
4949
const props = defineProps(pickerViewProps)
@@ -53,6 +53,7 @@ const formatColumns = ref<Record<string, string>[][]>([])
5353
const itemHeight = ref<number>(35)
5454
const selectedIndex = ref<Array<number>>([]) // 格式化之后,每列选中的下标集合
5555
const preSelectedIndex = ref<Array<number>>([])
56+
const emit = defineEmits(['change', 'pickstart', 'pickend', 'update:modelValue'])
5657
5758
watch(
5859
() => props.modelValue,
@@ -103,7 +104,7 @@ watch(
103104
watch(
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
)
115116
const { 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

Comments
 (0)