feat(Picker): allow option text to be number type (#8951)

This commit is contained in:
neverland
2021-06-29 20:20:05 +08:00
committed by GitHub
parent 17c5c5d8a7
commit e366b336e3
4 changed files with 13 additions and 10 deletions
+8 -5
View File
@@ -94,7 +94,11 @@ export default defineComponent({
setup(props, { emit, slots }) {
const formattedColumns = ref<PickerObjectColumn[]>([]);
const { text: textKey, values: valuesKey, children: childrenKey } = extend(
const {
text: textKey,
values: valuesKey,
children: childrenKey,
} = extend(
{
// compatible with valueKey prop
text: props.valueKey,
@@ -104,9 +108,8 @@ export default defineComponent({
props.columnsFieldNames
);
const { children, linkChildren } = useChildren<ComponentInstance>(
PICKER_KEY
);
const { children, linkChildren } =
useChildren<ComponentInstance>(PICKER_KEY);
linkChildren();
@@ -114,7 +117,7 @@ export default defineComponent({
const dataType = computed(() => {
const firstColumn = props.columns[0];
if (firstColumn && typeof firstColumn !== 'string') {
if (typeof firstColumn === 'object') {
if (childrenKey in firstColumn) {
return 'cascade';
}