Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
茶陵後
Git2
提交
c2a05d7b
G
Git2
项目概览
茶陵後
/
Git2
与 Fork 源项目一致
Fork自
gitcode_dev / 开源百科
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Git2
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
c2a05d7b
编写于
4月 30, 2021
作者:
X
xjh22222228
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(#95): icon support
上级
7d134339
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
42 addition
and
7 deletion
+42
-7
nav.config.ts
nav.config.ts
+4
-0
src/components/ellipsis/index.component.html
src/components/ellipsis/index.component.html
+2
-0
src/components/ellipsis/index.component.scss
src/components/ellipsis/index.component.scss
+6
-0
src/components/ellipsis/index.component.ts
src/components/ellipsis/index.component.ts
+3
-2
src/types/index.d.ts
src/types/index.d.ts
+1
-0
src/view/admin/index.component.html
src/view/admin/index.component.html
+2
-2
src/view/index/side/index.component.html
src/view/index/side/index.component.html
+12
-2
src/view/index/side/index.component.ts
src/view/index/side/index.component.ts
+12
-1
未找到文件。
nav.config.ts
浏览文件 @
c2a05d7b
...
...
@@ -34,6 +34,10 @@ const c: IConfig = {
<div>Copyright © 2018-2021 nav3.cn, All Rights Reserved</div>
`
,
// 阿里巴巴矢量图库 https://www.iconfont.cn/
// 用在 Side 主题一级、二级菜单图标展示
iconfontUrl
:
'
//at.alicdn.com/t/font_2522843_wl70o31sy6.js
'
,
// 百度统计地址
// https://tongji.baidu.com/web/welcome/login
baiduStatisticsUrl
:
'
https://hm.baidu.com/hm.js?4582be7af7e7c95ef75351e07c6c32ba
'
,
...
...
src/components/ellipsis/index.component.html
浏览文件 @
c2a05d7b
<i
nz-icon
[nzIconfont]=
"icon"
class=
"icon"
*ngIf=
"icon"
></i>
<div
#box
>
<div
nz-tooltip
...
...
src/components/ellipsis/index.component.scss
浏览文件 @
c2a05d7b
...
...
@@ -3,3 +3,9 @@
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
.icon
{
position
:
absolute
;
top
:
12px
;
left
:
25px
;
}
src/components/ellipsis/index.component.ts
浏览文件 @
c2a05d7b
...
...
@@ -25,13 +25,14 @@ function getWidthInText(str) {
})
export
class
EllipsisComponent
{
@
Input
()
text
:
string
@
ViewChild
(
'
box
'
)
box
:
ElementRef
;
@
Input
()
icon
:
string
@
ViewChild
(
'
box
'
)
box
:
ElementRef
<
Element
>
;
isOver
=
false
ngOnInit
()
{
queueMicrotask
(()
=>
{
const
el
=
this
.
box
?.
nativeElement
as
HTMLElement
const
el
=
this
.
box
?.
nativeElement
if
(
!
el
)
return
const
textWidth
=
el
.
clientWidth
...
...
src/types/index.d.ts
浏览文件 @
c2a05d7b
...
...
@@ -78,6 +78,7 @@ export interface IConfig {
footerContent
?:
string
|
null
baiduStatisticsUrl
?:
string
cnzzStatisticsUrl
?:
string
iconfontUrl
?:
string
showGithub
:
boolean
simThemeConfig
:
{
...
...
src/view/admin/index.component.html
浏览文件 @
c2a05d7b
...
...
@@ -383,10 +383,10 @@
</nz-form-item>
<nz-form-item>
<nz-form-label
[nzSpan]=
"6"
>
图标
地址
</nz-form-label>
<nz-form-label
[nzSpan]=
"6"
>
图标
</nz-form-label>
<nz-form-control
[nzSpan]=
"18"
>
<nz-input-group
[nzPrefix]=
"prefixIcon"
>
<input
formControlName=
"icon"
nz-input
placeholder=
"https://example.com/favicon.png"
/>
<input
formControlName=
"icon"
nz-input
/>
</nz-input-group>
<ng-template
#prefixIcon
>
...
...
src/view/index/side/index.component.html
浏览文件 @
c2a05d7b
...
...
@@ -9,11 +9,16 @@
<li
nz-submenu
[(nzOpen)]=
"pageIdx === openIndex"
[nzTitle]=
"item.title"
*ngFor=
"let item of websiteList; index as pageIdx;"
[class.remove]=
"!isLogin && item.ownVisible"
(nzOpenChange)=
"openIndex = pageIdx"
[nzTitle]=
"titleTpl"
>
<ng-template
#titleTpl
>
<i
nz-icon
[nzIconfont]=
"item.icon"
*ngIf=
"item.icon"
></i>
<span>
{{ item.title }}
</span>
</ng-template>
<ul>
<li
nz-menu-item
...
...
@@ -22,7 +27,11 @@
[nzSelected]=
"page === pageIdx && id === idIdx"
(click)=
"handleSidebarNav(pageIdx, idIdx)"
>
<app-ellipsis
[text]=
"el.title"
></app-ellipsis>
<app-ellipsis
[text]=
"el.title"
[icon]=
"el.icon"
>
</app-ellipsis>
<div
*ngIf=
"page === pageIdx && id === idIdx"
...
...
@@ -40,6 +49,7 @@
</li>
</ul>
</nz-sider>
<nz-layout
class=
"inner-layout"
>
<nz-content
class=
"content"
id=
"content"
>
<div
class=
"search-header dark-bg-deep dark-border-color"
>
...
...
src/view/index/side/index.component.ts
浏览文件 @
c2a05d7b
...
...
@@ -16,6 +16,7 @@ import { isLogin } from '../../../utils/user'
import
{
websiteList
}
from
'
../../../store
'
import
{
LOGO_CDN
}
from
'
../../../constants
'
import
*
as
s
from
'
../../../../data/search.json
'
import
{
NzIconService
}
from
'
ng-zorro-antd/icon
'
const
searchEngineList
:
ISearchEngineProps
[]
=
(
s
as
any
).
default
...
...
@@ -38,7 +39,17 @@ export default class SideComponent {
isFirst
=
false
isLogin
=
isLogin
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
)
{}
constructor
(
private
router
:
Router
,
private
activatedRoute
:
ActivatedRoute
,
private
iconService
:
NzIconService
)
{
if
(
config
.
iconfontUrl
)
{
this
.
iconService
.
fetchFromIconfont
({
scriptUrl
:
config
.
iconfontUrl
})
}
}
ngOnInit
()
{
this
.
activatedRoute
.
queryParams
.
subscribe
(()
=>
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录