Skip to content

Commit d5e462f

Browse files
committed
fix: 统一文档风格
1 parent 46911d2 commit d5e462f

File tree

5 files changed

+30
-41
lines changed

5 files changed

+30
-41
lines changed
Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
import {
2-
defineComponent,
3-
renderSlot,
4-
computed,
5-
getCurrentInstance,
6-
inject,
7-
} from 'vue';
8-
import { className } from '../../utils/index';
9-
import { selectKey } from '../../editable-select-types';
1+
import { defineComponent, renderSlot, getCurrentInstance, inject } from 'vue'
2+
import { className } from '../../utils/index'
3+
import { selectKey } from '../../editable-select-types'
104
export default defineComponent({
115
name: 'DEditableSelectOption',
126
props: {
@@ -21,27 +15,22 @@ export default defineComponent({
2115
setup(props, ctx) {
2216
const optionsClassName = className('devui-dropdown-item', {
2317
disabled: props.disabled,
24-
});
25-
const currentLabel = computed(() => {
26-
return props.label;
27-
});
28-
const instance = getCurrentInstance();
18+
})
19+
const instance = getCurrentInstance()
2920

30-
const select = inject(selectKey);
21+
const select = inject(selectKey)
3122

3223
const selectOptionClick = () => {
3324
if (!props.disabled) {
34-
select.handleOptionSelect(instance);
25+
select.handleOptionSelect(instance)
3526
}
36-
};
27+
}
3728
return () => {
3829
return (
3930
<li class={optionsClassName} onClick={selectOptionClick}>
40-
{currentLabel.value
41-
? currentLabel.value
42-
: renderSlot(ctx.slots, 'default')}
31+
{props.label ? props.label : renderSlot(ctx.slots, 'default')}
4332
</li>
44-
);
45-
};
33+
)
34+
}
4635
},
47-
});
36+
})

devui/editable-select/src/editable-select-types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const editableSelectProps = {
2626
},
2727
'onUpdate:modelValue': {
2828
type: Function as PropType<(val: ModelValue) => void>,
29-
default: undefined,
3029
},
3130
} as const
3231

devui/editable-select/src/editable-select.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
import './editable-select.scss';
1+
import './editable-select.scss'
22
import {
33
defineComponent,
44
reactive,
55
toRefs,
66
renderSlot,
77
provide,
88
SetupContext,
9-
} from 'vue';
9+
} from 'vue'
1010
import {
1111
editableSelectProps,
1212
EditableSelectProps,
1313
selectKey,
14-
} from './editable-select-types';
15-
import { Icon } from '../../icon';
16-
import { FlexibleOverlay } from '../../overlay';
17-
import { useSelectStates, useSelect } from './hooks/use-select';
18-
import { className } from './utils/index';
14+
} from './editable-select-types'
15+
import { Icon } from '../../icon'
16+
import { FlexibleOverlay } from '../../overlay'
17+
import { useSelectStates, useSelect } from './hooks/use-select'
18+
import { className } from './utils/index'
1919
export default defineComponent({
2020
name: 'DEditableSelect',
2121
props: editableSelectProps,
2222
emits: ['update:modelValue'],
2323

2424
setup(props: EditableSelectProps, ctx: SetupContext) {
25-
const states = useSelectStates();
26-
const { origin, visible } = toRefs(states);
25+
const states = useSelectStates()
26+
const { origin, visible } = toRefs(states)
2727

2828
const inputCls = className('devui-form-control devui-dropdown-origin', {
2929
disabled: props.disabled,
30-
});
31-
const { toggleMenu, handleOptionSelect } = useSelect(props, ctx, states);
30+
})
31+
const { toggleMenu, handleOptionSelect } = useSelect(props, ctx, states)
3232

3333
provide(
3434
selectKey,
3535
reactive({
3636
handleOptionSelect,
3737
})
38-
);
38+
)
3939

4040
return () => {
4141
return (
@@ -75,7 +75,7 @@ export default defineComponent({
7575
</div>
7676
</FlexibleOverlay>
7777
</>
78-
);
79-
};
78+
)
79+
}
8080
},
81-
});
81+
})

devui/editable-select/src/utils/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ export function className(
88
classStr: string,
99
classOpt?: { [key: string]: boolean; }
1010
): string {
11-
let classname = classStr;
11+
let classname = classStr
1212
if (typeof classOpt === 'object') {
1313
Object.keys(classOpt).forEach((key) => {
1414
classOpt[key] && (classname += ` ${key}`);
1515
});
1616
}
17-
return classname;
17+
return classname
1818
}

docs/components/editable-select/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,6 @@ export default defineComponent({
3333
},
3434
});
3535
</script>
36+
3637
```
3738
:::

0 commit comments

Comments
 (0)