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 11// generated by unplugin-vue-components
22// 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
44import '@vue/runtime-core'
55
66declare module '@vue/runtime-core' {
Original file line number Diff line number Diff line change 11<template >
22 <div >
3- <el-button m = " b-2 " @click =" toggle" > Switch Lang </el-button >
3+ <el-button mb-2 @click =" toggle" >Switch Language </el-button >
44 <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" />
79 </el-config-provider >
810 </div >
911</template >
1012
1113<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 ))
1320
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- })
3221const 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'
3623}
3724 </script >
You can’t perform that action at this time.
0 commit comments