Commit 51396263 by DaiJiezhang

fix: 挂载 Element Plus 中文语言包

构建产物此前走内置英文默认,分页器显示 20/page、删除确认框显示 OK。
显式注入 zh-cn 后统一为中文,并同步更新按英文按钮定位的回归用例。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
parent 8823738a
import { createApp } from 'vue/dist/vue.esm-bundler.js'; import { createApp } from 'vue/dist/vue.esm-bundler.js';
import ElementPlus from 'element-plus'; import ElementPlus from 'element-plus';
// Element Plus 默认语言是英文,分页器会显示 20/page、Go to 之类;这里显式挂中文包。
import zhCn from 'element-plus/es/locale/lang/zh-cn';
import 'element-plus/dist/index.css'; import 'element-plus/dist/index.css';
import App from './App.js'; import App from './App.js';
import AppPagination from './components/AppPagination.js'; import AppPagination from './components/AppPagination.js';
...@@ -12,7 +14,7 @@ import './styles/auth-state.css'; ...@@ -12,7 +14,7 @@ import './styles/auth-state.css';
* 关联文件:frontend/index.html、frontend/src/App.js、frontend/src/router/index.js。 * 关联文件:frontend/index.html、frontend/src/App.js、frontend/src/router/index.js。
* 关联逻辑(调用链/数据流):index.html -> main.js -> createApp() -> router -> 静态参考页或重构占位页。 * 关联逻辑(调用链/数据流):index.html -> main.js -> createApp() -> router -> 静态参考页或重构占位页。
*/ */
const application = createApp(App).use(router).use(ElementPlus); const application = createApp(App).use(router).use(ElementPlus, { locale: zhCn });
// 分页器全局注册:四个列表页共用一套外观与空数据表现,避免各页模板再次分叉。 // 分页器全局注册:四个列表页共用一套外观与空数据表现,避免各页模板再次分叉。
application.component('AppPagination', AppPagination); application.component('AppPagination', AppPagination);
await router.isReady(); await router.isReady();
......
...@@ -77,7 +77,7 @@ test('keeps a referenced device visible after protected delete response', async ...@@ -77,7 +77,7 @@ test('keeps a referenced device visible after protected delete response', async
await page.route('**/api/device-assets**', async route=>{const request=route.request();const data=request.method()==='GET'?{records:[{id:8,deviceName:'protected-device',imageAttachment1Url:null,imageAttachment2Url:null,userPersonId:null,userPersonName:null,userUsageStatus:'\u4f7f\u7528\u4e2d',assetRelationStatus:'\u5df2\u5173\u8054',createTime:'',updateTime:''}],total:1,page:1,size:20}:null;const response=request.method()==='DELETE'?{code:400,message:'\u8bbe\u5907\u4ecd\u88ab\u624b\u673a\u53f7\u8d44\u4ea7\u5f15\u7528\uff0c\u4e0d\u80fd\u5220\u9664',data:null}:{code:200,message:'success',data};await route.fulfill({contentType:'application/json',body:JSON.stringify(response)});}); await page.route('**/api/device-assets**', async route=>{const request=route.request();const data=request.method()==='GET'?{records:[{id:8,deviceName:'protected-device',imageAttachment1Url:null,imageAttachment2Url:null,userPersonId:null,userPersonName:null,userUsageStatus:'\u4f7f\u7528\u4e2d',assetRelationStatus:'\u5df2\u5173\u8054',createTime:'',updateTime:''}],total:1,page:1,size:20}:null;const response=request.method()==='DELETE'?{code:400,message:'\u8bbe\u5907\u4ecd\u88ab\u624b\u673a\u53f7\u8d44\u4ea7\u5f15\u7528\uff0c\u4e0d\u80fd\u5220\u9664',data:null}:{code:200,message:'success',data};await route.fulfill({contentType:'application/json',body:JSON.stringify(response)});});
await page.goto('/asset/#/device-assets'); await page.goto('/asset/#/device-assets');
await page.locator('.el-table').getByRole('button',{name:'\u5220\u9664'}).click(); await page.locator('.el-table').getByRole('button',{name:'\u5220\u9664'}).click();
await page.getByRole('button',{name:'OK'}).click(); await page.getByRole('button',{name:'确定'}).click();
await expect(page.getByText('\u8bbe\u5907\u4ecd\u88ab\u624b\u673a\u53f7\u8d44\u4ea7\u5f15\u7528\uff0c\u4e0d\u80fd\u5220\u9664')).toBeVisible(); await expect(page.getByText('\u8bbe\u5907\u4ecd\u88ab\u624b\u673a\u53f7\u8d44\u4ea7\u5f15\u7528\uff0c\u4e0d\u80fd\u5220\u9664')).toBeVisible();
await expect(page.locator('.el-table').getByText('protected-device',{exact:true})).toBeVisible(); await expect(page.locator('.el-table').getByText('protected-device',{exact:true})).toBeVisible();
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment