fix: locale update bug (#611)

This commit is contained in:
zazzaz 2020-11-18 22:20:36 +08:00 committed by GitHub
parent 33e80d6e25
commit 8181a08cf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -21,14 +21,14 @@
:type="cancelButtonType"
@click="cancel"
>
{{ cancelButtonText }}
{{ cancelButtonText_ }}
</el-button>
<el-button
size="mini"
:type="confirmButtonType"
@click="confirm"
>
{{ confirmButtonText }}
{{ confirmButtonText_ }}
</el-button>
</div>
</div>
@ -39,7 +39,7 @@
</template>
<script lang="ts">
import { defineComponent,ref } from 'vue'
import { defineComponent, ref, computed } from 'vue'
import { Button as ElButton } from '@element-plus/button'
import { Popper as ElPopper } from '@element-plus/popper'
import { t } from '../../locale'
@ -58,11 +58,9 @@ export default defineComponent({
},
confirmButtonText: {
type: String,
default: t('el.popconfirm.confirmButtonText'),
},
cancelButtonText: {
type: String,
default: t('el.popconfirm.cancelButtonText'),
},
confirmButtonType: {
type: String,
@ -96,11 +94,18 @@ export default defineComponent({
visible.value = false
emit('cancel')
}
const confirmButtonText_ = computed(() => {
return props.confirmButtonText || t('el.popconfirm.confirmButtonText')
})
const cancelButtonText_ = computed(() => {
return props.cancelButtonText || t('el.popconfirm.cancelButtonText')
})
return {
visible,
confirm,
cancel,
confirmButtonText_,
cancelButtonText_,
}
},
})

View File

@ -239,7 +239,6 @@ export default defineComponent({
},
placeholder: {
type: String,
default: t('el.select.placeholder'),
},
defaultFirstOption: Boolean,
reserveKeyword: Boolean,
@ -342,7 +341,7 @@ export default defineComponent({
}))
onMounted(() => {
states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder
states.cachedPlaceHolder = currentPlaceholder.value = (props.placeholder || t('el.select.placeholder'))
if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
currentPlaceholder.value = ''
}