File tree Expand file tree Collapse file tree 2 files changed +13
-26
lines changed Expand file tree Collapse file tree 2 files changed +13
-26
lines changed Original file line number Diff line number Diff line change 1
1
// generated by unplugin-vue-components
2
2
// We suggest you to commit this file into source control
3
- // Read more: https://github.com/vuejs/vue-next /pull/3399
3
+ // Read more: https://github.com/vuejs/core /pull/3399
4
4
import '@vue/runtime-core'
5
5
6
6
declare module '@vue/runtime-core' {
Original file line number Diff line number Diff line change 1
1
<template >
2
2
<div >
3
- <el-button m = " b-2 " @click =" toggle" > Switch Lang </el-button >
3
+ <el-button mb-2 @click =" toggle" >Switch Language </el-button >
4
4
<br />
5
- <el-config-provider :locale =" locale2" >
6
- <el-color-picker :model-value =" ''" style =" vertical-align : middle " />
5
+
6
+ <el-config-provider :locale =" locale" >
7
+ <el-table mb-1 :data =" []" />
8
+ <el-pagination :total =" 100" />
7
9
</el-config-provider >
8
10
</div >
9
11
</template >
10
12
11
13
<script lang="ts" setup>
12
- import { ref } from ' vue'
14
+ import { computed , ref } from ' vue'
15
+ import zhCn from ' element-plus/dist/locale/zh-cn.mjs'
16
+ import en from ' element-plus/dist/locale/en.mjs'
17
+
18
+ const language = ref (' zh-cn' )
19
+ const locale = computed (() => (language .value === ' zh-cn' ? zhCn : en ))
13
20
14
- const locale1 = ref ({
15
- name: ' zh-cn' ,
16
- el: {
17
- colorpicker: {
18
- confirm: ' 确定' ,
19
- clear: ' 清空' ,
20
- },
21
- },
22
- })
23
- const locale2 = ref ({
24
- name: ' en' ,
25
- el: {
26
- colorpicker: {
27
- confirm: ' Confirm' ,
28
- clear: ' Clear' ,
29
- },
30
- },
31
- })
32
21
const toggle = () => {
33
- const temp = locale1 .value
34
- locale1 .value = locale2 .value
35
- locale2 .value = temp
22
+ language .value = language .value === ' zh-cn' ? ' en' : ' zh-cn'
36
23
}
37
24
</script >
You can’t perform that action at this time.
0 commit comments