mirror of
https://gitee.com/ShopeX/ECShopX_desktop-frontend
synced 2026-05-13 01:45:58 +08:00
v4.5.0
This commit is contained in:
@@ -410,7 +410,7 @@ $num-color : #FF5D02;
|
||||
<div class="user-tabs">
|
||||
<template v-for="tab in userTabs">
|
||||
<!-- <div class="tab" :style="{ width: `${100 / userTabs.length}%` }"> -->
|
||||
<div class="tab" :style="{ width: `${100 / (userTabs.length-1)}%` }" :v-show="tab.title!=$t('member.user-info.869309-21')">
|
||||
<div class="tab" :style="{ width: `${100 / (userTabs.length-1)}%` }" v-show="tab.title != $t('member.user-info.869309-21')">
|
||||
<router-link :to="tab.link">
|
||||
<h4 class="num">
|
||||
<span v-if="tab.icon" class="icon">{{ tab.icon }}</span>
|
||||
|
||||
@@ -6,6 +6,12 @@
|
||||
import { defaultLocale } from './language'
|
||||
import { getlanguageByPath } from './doc'
|
||||
|
||||
/**
|
||||
* nuxt-i18n strategy `prefix_and_default`:
|
||||
* URLs for the default locale do NOT include the locale prefix (e.g. `/cart`),
|
||||
* while other locales use a prefix (e.g. `/zh/cart`).
|
||||
*/
|
||||
|
||||
/**
|
||||
* 生成本地化路径(带语言前缀)
|
||||
* @param {string} path - 原始路径,如 '/items/123' 或 '/items'
|
||||
@@ -51,16 +57,13 @@ export function localePath(path, locale = null, context = null) {
|
||||
// 如果路径已经包含语言前缀,先移除
|
||||
const pathWithoutLang = path.replace(/^\/(zh|en|ar)(\/|$)/, '/')
|
||||
|
||||
// 如果是默认语言且路径是根路径,可以不添加语言前缀(根据 nuxt-i18n 的 prefix_and_default 策略)
|
||||
// 但为了保持一致性,我们总是添加语言前缀
|
||||
if (currentLocale === defaultLocale && pathWithoutLang === '/') {
|
||||
return '/'
|
||||
}
|
||||
|
||||
// 确保路径以 / 开头
|
||||
const normalizedPath = pathWithoutLang.startsWith('/') ? pathWithoutLang : `/${pathWithoutLang}`
|
||||
|
||||
// 生成带语言前缀的路径
|
||||
|
||||
if (currentLocale === defaultLocale) {
|
||||
return normalizedPath === '/' ? '/' : normalizedPath
|
||||
}
|
||||
|
||||
return `/${currentLocale}${normalizedPath}`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user