refactor(components): [time-select] use useNamespace (#6459)

This commit is contained in:
gjfei 2022-04-12 21:40:17 +08:00 committed by GitHub
parent f333ab898b
commit 2afb4a8611
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -23,7 +23,7 @@
:disabled="item.disabled"
/>
<template #prefix>
<el-icon v-if="prefixIcon" class="el-input__prefix-icon">
<el-icon v-if="prefixIcon" :class="nsInput.e('prefix-icon')">
<component :is="prefixIcon" />
</el-icon>
</template>
@ -37,6 +37,7 @@ import customParseFormat from 'dayjs/plugin/customParseFormat.js'
import ElSelect from '@element-plus/components/select'
import ElIcon from '@element-plus/components/icon'
import { CircleClose, Clock } from '@element-plus/icons-vue'
import { useNamespace } from '@element-plus/hooks'
import { componentSizes } from '@element-plus/constants'
import type { Component, PropType } from 'vue'
@ -170,8 +171,9 @@ export default defineComponent({
},
emits: ['change', 'blur', 'focus', 'update:modelValue'],
setup(props) {
// computed
const nsInput = useNamespace('input')
const select = ref(null)
const value = computed(() => props.modelValue)
const start = computed(() => {
const time = parseTime(props.start)
@ -219,6 +221,7 @@ export default defineComponent({
}
return {
nsInput,
select,
value,
items,