mirror of
https://gitee.com/element-plus/element-plus.git
synced 2024-12-15 09:50:58 +08:00
25 lines
623 B
Vue
25 lines
623 B
Vue
<template>
|
|
<div>
|
|
<el-button mb-2 @click="toggle">Switch Language</el-button>
|
|
<br />
|
|
|
|
<el-config-provider :locale="locale">
|
|
<el-table mb-1 :data="[]" />
|
|
<el-pagination :total="100" />
|
|
</el-config-provider>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, ref } from 'vue'
|
|
import zhCn from 'element-plus/dist/locale/zh-cn.mjs'
|
|
import en from 'element-plus/dist/locale/en.mjs'
|
|
|
|
const language = ref('zh-cn')
|
|
const locale = computed(() => (language.value === 'zh-cn' ? zhCn : en))
|
|
|
|
const toggle = () => {
|
|
language.value = language.value === 'zh-cn' ? 'en' : 'zh-cn'
|
|
}
|
|
</script>
|