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

View File

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