Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DiDi
DoraemonKit
提交
380d95af
D
DoraemonKit
项目概览
DiDi
/
DoraemonKit
10 个月 前同步成功
通知
166
Star
19623
Fork
3062
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
DoraemonKit
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
380d95af
编写于
10月 20, 2021
作者:
A
AdamCaoQAQ
提交者:
GitHub
10月 20, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #922 from bukecat/dev/jianke
dikit-for-web add web-vitals-time plugin
上级
6cdde615
63ded819
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
90 addition
and
4 deletion
+90
-4
Web/package-lock.json
Web/package-lock.json
+5
-0
Web/package.json
Web/package.json
+2
-1
Web/packages/web/src/feature.js
Web/packages/web/src/feature.js
+4
-3
Web/packages/web/src/plugins/web-vitals-time/index.js
Web/packages/web/src/plugins/web-vitals-time/index.js
+10
-0
Web/packages/web/src/plugins/web-vitals-time/info-box.vue
Web/packages/web/src/plugins/web-vitals-time/info-box.vue
+69
-0
未找到文件。
Web/package-lock.json
浏览文件 @
380d95af
...
...
@@ -14253,6 +14253,11 @@
"defaults": "^1.0.3"
}
},
"web-vitals": {
"version": "2.1.2",
"resolved": "http://registry.npm.xiaojukeji.com/web-vitals/download/web-vitals-2.1.2.tgz",
"integrity": "sha1-OmyPrr+Ql6bM0X9fRclIXY1i2rE="
},
"webidl-conversions": {
"version": "6.1.0",
"resolved": "https://registry.npm.taobao.org/webidl-conversions/download/webidl-conversions-6.1.0.tgz",
...
...
Web/package.json
浏览文件 @
380d95af
...
...
@@ -39,6 +39,7 @@
"serve-handler"
:
"^6.1.3"
},
"dependencies"
:
{
"vant"
:
"^3.1.0-beta.0"
"vant"
:
"^3.1.0-beta.0"
,
"web-vitals"
:
"^2.1.2"
}
}
Web/packages/web/src/feature.js
浏览文件 @
380d95af
...
...
@@ -9,12 +9,13 @@ import AlignRuler from './plugins/align-ruler/index'
import
HelloWorld
from
'
./components/ToolHelloWorld
'
import
Resource
from
'
./plugins/resources/index
'
import
ApiMock
from
'
./plugins/api-mock/index
'
import
WebVitals
from
'
./plugins/web-vitals-time/index
'
import
{
IndependPlugin
,
RouterPlugin
}
from
'
@dokit/web-core
'
export
const
BasicFeatures
=
{
title
:
'
常用工具
'
,
list
:
[
Console
,
AppInfo
,
Resource
,
Network
,
Storage
,
DemoPlugin
,
DemoIndependPlugin
,
H5DoorPlugin
]
list
:
[
Console
,
AppInfo
,
Resource
,
Network
,
Storage
,
DemoPlugin
,
DemoIndependPlugin
,
H5DoorPlugin
,
WebVitals
]
// list: [Console, AppInfo, Resource, Network, Storage, H5DoorPlugin]
}
...
...
@@ -26,7 +27,7 @@ export const DokitFeatures = {
export
const
UIFeatures
=
{
title
:
'
视觉功能
'
,
list
:
[
AlignRuler
]
// list: [AlignRuler,
// list: [AlignRuler,
// new RouterPlugin({
// nameZh: 'UI结构',
// name: 'view-selector',
...
...
@@ -34,4 +35,4 @@ export const UIFeatures = {
// component: HelloWorld
// })]
}
export
const
Features
=
[
BasicFeatures
,
DokitFeatures
,
UIFeatures
]
\ No newline at end of file
export
const
Features
=
[
BasicFeatures
,
DokitFeatures
,
UIFeatures
]
Web/packages/web/src/plugins/web-vitals-time/index.js
0 → 100644
浏览文件 @
380d95af
import
WebVitalsTime
from
'
./info-box.vue
'
import
{
RouterPlugin
}
from
'
@dokit/web-core
'
export
default
new
RouterPlugin
({
nameZh
:
'
性能
'
,
name
:
'
webVitalsTime
'
,
icon
:
'
https://pt-starimg.didistatic.com/static/starimg/img/6WONqJCVks1621926657356.png
'
,
component
:
WebVitalsTime
})
Web/packages/web/src/plugins/web-vitals-time/info-box.vue
0 → 100644
浏览文件 @
380d95af
<
template
>
<div
class=
"web-vitals-time"
>
<div
class=
"title"
>
性能指标(web vitals)
</div>
<div
class=
"desc"
>
请在页面加载完成后再获取指标
</div>
<div
class=
"content"
>
<div><span
class=
"item important"
>
FCP:
</span>
{{
FCP
}}
</div>
<div><span
class=
"item important"
>
LCP:
</span>
{{
LCP
}}
</div>
<div><span
class=
"item"
>
CLS:
</span>
{{
CLS
}}
</div>
<div><span
class=
"item"
>
FID:
</span>
{{
FID
}}
</div>
<div><span
class=
"item"
>
TTFB:
</span>
{{
TTFB
}}
</div>
</div>
</div>
</
template
>
<
script
>
import
{
getFCP
,
getLCP
,
getFID
,
getCLS
,
getTTFB
}
from
'
web-vitals
'
;
export
default
{
data
()
{
return
{
FCP
:
''
,
CLS
:
''
,
FID
:
''
,
LCP
:
''
,
TTFB
:
''
}
},
mounted
()
{
getFCP
(
this
.
handleData
);
getLCP
(
this
.
handleData
,
true
);
getCLS
(
this
.
handleData
,
true
);
getFID
(
this
.
handleData
);
getTTFB
(
this
.
handleData
);
},
methods
:
{
handleData
(
detail
)
{
console
.
log
(
JSON
.
parse
(
JSON
.
stringify
(
detail
)))
const
{
name
,
value
}
=
detail
this
[
name
]
=
Math
.
round
(
value
)
+
'
ms
'
}
}
}
</
script
>
<
style
lang=
"less"
scoped
>
.web-vitals-time {
padding: 10px;
text-align: center;
.title {
font-weight: bold;
font-size: 22px;
}
.desc {
font-size: 12px;
color: #999999;
}
.content {
text-align: left;
margin-top: 20px;
padding-left: 5%;
}
.item {
display: inline-block;
text-align: right;
width: 60px;
margin-top: 4px;
}
.important {
color: red;
}
}
</
style
>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录