Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
夏日掠影
vue-vben-admin
提交
d677729a
V
vue-vben-admin
项目概览
夏日掠影
/
vue-vben-admin
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
V
vue-vben-admin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d677729a
编写于
6月 06, 2021
作者:
V
Vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
perf(i18n): improve circular dependencies
上级
d81481c5
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
30 addition
and
57 deletion
+30
-57
src/components/Application/src/AppDarkModeToggle.vue
src/components/Application/src/AppDarkModeToggle.vue
+2
-18
src/components/Application/src/search/AppSearch.vue
src/components/Application/src/search/AppSearch.vue
+0
-9
src/components/Application/src/search/AppSearchFooter.vue
src/components/Application/src/search/AppSearchFooter.vue
+0
-4
src/components/Application/src/search/AppSearchModal.vue
src/components/Application/src/search/AppSearchModal.vue
+8
-10
src/layouts/default/header/index.vue
src/layouts/default/header/index.vue
+3
-1
src/locales/helper.ts
src/locales/helper.ts
+12
-0
src/locales/setupI18n.ts
src/locales/setupI18n.ts
+3
-4
src/locales/useLocale.ts
src/locales/useLocale.ts
+2
-11
未找到文件。
src/components/Application/src/AppDarkModeToggle.vue
浏览文件 @
d677729a
...
...
@@ -29,17 +29,12 @@
export
default
defineComponent
({
name
:
'
DarkModeToggle
'
,
components
:
{
SvgIcon
},
// props: {
// size: {
// type: String,
// default: 'default',
// validate: (val) => ['default', 'large'].includes(val),
// },
// },
setup
()
{
const
{
prefixCls
}
=
useDesign
(
'
dark-mode-toggle
'
);
const
{
getDarkMode
,
setDarkMode
,
getShowDarkModeToggle
}
=
useRootSetting
();
const
isDark
=
computed
(()
=>
getDarkMode
.
value
===
ThemeEnum
.
DARK
);
function
toggleDarkMode
()
{
const
darkMode
=
getDarkMode
.
value
===
ThemeEnum
.
DARK
?
ThemeEnum
.
LIGHT
:
ThemeEnum
.
DARK
;
setDarkMode
(
darkMode
);
...
...
@@ -95,16 +90,5 @@
transform: translateX(calc(100% + 2px));
}
}
// &--large {
// width: 70px;
// height: 34px;
// padding: 0 10px;
// .@{prefix-cls}-inner {
// width: 26px;
// height: 26px;
// }
// }
}
</
style
>
src/components/Application/src/search/AppSearch.vue
浏览文件 @
d677729a
<
script
lang=
"tsx"
>
import
{
defineComponent
,
ref
,
unref
}
from
'
vue
'
;
import
{
Tooltip
}
from
'
ant-design-vue
'
;
import
{
SearchOutlined
}
from
'
@ant-design/icons-vue
'
;
import
AppSearchModal
from
'
./AppSearchModal.vue
'
;
import
{
useHeaderSetting
}
from
'
/@/hooks/setting/useHeaderSetting
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
export
default
defineComponent
({
name
:
'
AppSearch
'
,
components
:
{
AppSearchModal
,
Tooltip
},
setup
()
{
const
showModal
=
ref
(
false
);
const
{
getShowSearch
}
=
useHeaderSetting
();
const
{
t
}
=
useI18n
();
function
changeModal
(
show
:
boolean
)
{
...
...
@@ -22,9 +16,6 @@
}
return
()
=>
{
if
(
!
unref
(
getShowSearch
))
{
return
null
;
}
return
(
<
div
class
=
"
p-1
"
onClick
=
{
changeModal
.
bind
(
null
,
true
)}
>
<
Tooltip
>
...
...
src/components/Application/src/search/AppSearchFooter.vue
浏览文件 @
d677729a
...
...
@@ -2,21 +2,17 @@
<div
:class=
"`$
{prefixCls}`">
<AppSearchKeyItem
:class=
"`$
{prefixCls}__item`" icon="ant-design:enter-outlined" />
<span>
{{
t
(
'
component.app.toSearch
'
)
}}
</span>
<AppSearchKeyItem
:class=
"`$
{prefixCls}__item`" icon="ion:arrow-up-outline" />
<AppSearchKeyItem
:class=
"`$
{prefixCls}__item`" icon="ion:arrow-down-outline" />
<span>
{{
t
(
'
component.app.toNavigate
'
)
}}
</span>
<AppSearchKeyItem
:class=
"`$
{prefixCls}__item`" icon="mdi:keyboard-esc" />
<span>
{{
t
(
'
common.closeText
'
)
}}
</span>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
defineComponent
}
from
'
vue
'
;
import
AppSearchKeyItem
from
'
./AppSearchKeyItem.vue
'
;
import
{
useDesign
}
from
'
/@/hooks/web/useDesign
'
;
import
{
useI18n
}
from
'
/@/hooks/web/useI18n
'
;
export
default
defineComponent
({
...
...
src/components/Application/src/search/AppSearchModal.vue
浏览文件 @
d677729a
...
...
@@ -85,7 +85,7 @@
visible
:
propTypes
.
bool
,
},
emits
:
[
'
close
'
],
setup
(
_
,
{
emit
})
{
setup
(
props
,
{
emit
})
{
const
scrollWrap
=
ref
<
ElRef
>
(
null
);
const
{
prefixCls
}
=
useDesign
(
'
app-search-modal
'
);
const
{
t
}
=
useI18n
();
...
...
@@ -96,9 +96,7 @@
const
{
handleSearch
,
searchResult
,
keyword
,
activeIndex
,
handleEnter
,
handleMouseenter
}
=
useMenuSearch
(
refs
,
scrollWrap
,
emit
);
const
getIsNotData
=
computed
(()
=>
{
return
!
keyword
||
unref
(
searchResult
).
length
===
0
;
});
const
getIsNotData
=
computed
(()
=>
!
keyword
||
unref
(
searchResult
).
length
===
0
);
const
getClass
=
computed
(()
=>
{
return
[
...
...
@@ -109,13 +107,8 @@
];
});
function
handleClose
()
{
searchResult
.
value
=
[];
emit
(
'
close
'
);
}
watch
(
()
=>
_
.
visible
,
()
=>
props
.
visible
,
(
v
:
boolean
)
=>
{
v
&&
nextTick
(()
=>
{
...
...
@@ -124,6 +117,11 @@
}
);
function
handleClose
()
{
searchResult
.
value
=
[];
emit
(
'
close
'
);
}
return
{
t
,
prefixCls
,
...
...
src/layouts/default/header/index.vue
浏览文件 @
d677729a
...
...
@@ -33,7 +33,7 @@
<!-- action -->
<div
:class=
"`$
{prefixCls}-action`">
<AppSearch
:class=
"`$
{prefixCls}-action__item `" />
<AppSearch
:class=
"`$
{prefixCls}-action__item `"
v-if="getShowSearch"
/>
<ErrorAction
v-if=
"getUseErrorHandle"
:class=
"`$
{prefixCls}-action__item error-action`" />
...
...
@@ -123,6 +123,7 @@
getShowBread
,
getShowHeaderLogo
,
getShowHeader
,
getShowSearch
,
}
=
useHeaderSetting
();
const
{
getShowLocalePicker
}
=
useLocale
();
...
...
@@ -190,6 +191,7 @@
getIsMixSidebar
,
getShowSettingButton
,
getShowSetting
,
getShowSearch
,
};
},
});
...
...
src/locales/helper.ts
浏览文件 @
d677729a
import
type
{
LocaleType
}
from
'
/#/config
'
;
import
{
set
}
from
'
lodash-es
'
;
export
const
loadLocalePool
:
LocaleType
[]
=
[];
export
function
setHtmlPageLang
(
locale
:
LocaleType
)
{
document
.
querySelector
(
'
html
'
)?.
setAttribute
(
'
lang
'
,
locale
);
}
export
function
setLoadLocalePool
(
cb
:
(
loadLocalePool
:
LocaleType
[])
=>
void
)
{
cb
(
loadLocalePool
);
}
export
function
genMessage
(
langs
:
Record
<
string
,
Record
<
string
,
any
>>
,
prefix
=
'
lang
'
)
{
const
obj
:
Recordable
=
{};
...
...
src/locales/setupI18n.ts
浏览文件 @
d677729a
...
...
@@ -2,8 +2,7 @@ import type { App } from 'vue';
import
type
{
I18n
,
I18nOptions
}
from
'
vue-i18n
'
;
import
{
createI18n
}
from
'
vue-i18n
'
;
import
{
setLoadLocalePool
,
setHtmlPageLang
}
from
'
./useLocale
'
;
import
{
setHtmlPageLang
,
setLoadLocalePool
}
from
'
./helper
'
;
import
{
localeSetting
}
from
'
/@/settings/localeSetting
'
;
import
{
useLocaleStoreWithOut
}
from
'
/@/store/modules/locale
'
;
...
...
@@ -16,8 +15,8 @@ async function createI18nOptions(): Promise<I18nOptions> {
const
locale
=
localeStore
.
getLocale
;
const
defaultLocal
=
await
import
(
`./lang/
${
locale
}
.ts`
);
const
message
=
defaultLocal
.
default
?.
message
??
{};
setHtmlPageLang
(
locale
)
setHtmlPageLang
(
locale
)
;
setLoadLocalePool
((
loadLocalePool
)
=>
{
loadLocalePool
.
push
(
locale
);
});
...
...
src/locales/useLocale.ts
浏览文件 @
d677729a
...
...
@@ -8,6 +8,7 @@ import moment from 'moment';
import
{
i18n
}
from
'
./setupI18n
'
;
import
{
useLocaleStoreWithOut
}
from
'
/@/store/modules/locale
'
;
import
{
unref
,
computed
}
from
'
vue
'
;
import
{
loadLocalePool
,
setHtmlPageLang
}
from
'
./helper
'
;
interface
LangModule
{
message
:
Recordable
;
...
...
@@ -15,16 +16,6 @@ interface LangModule {
momentLocaleName
:
string
;
}
const
loadLocalePool
:
LocaleType
[]
=
[];
export
function
setHtmlPageLang
(
locale
:
LocaleType
)
{
document
.
querySelector
(
'
html
'
)?.
setAttribute
(
'
lang
'
,
locale
);
}
export
function
setLoadLocalePool
(
cb
:
(
loadLocalePool
:
LocaleType
[])
=>
void
)
{
cb
(
loadLocalePool
);
}
function
setI18nLanguage
(
locale
:
LocaleType
)
{
const
localeStore
=
useLocaleStoreWithOut
();
...
...
@@ -34,7 +25,7 @@ function setI18nLanguage(locale: LocaleType) {
(
i18n
.
global
.
locale
as
any
).
value
=
locale
;
}
localeStore
.
setLocaleInfo
({
locale
});
setHtmlPageLang
(
locale
)
setHtmlPageLang
(
locale
)
;
}
export
function
useLocale
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录