Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
VueElementTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄瑜
VueElementTemplate
Commits
f9aaaa90
Commit
f9aaaa90
authored
Dec 12, 2017
by
Pan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf[errorLog]:optimized error-log
parent
85492f14
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
118 additions
and
74 deletions
+118
-74
index.vue
src/components/ErrLog/index.vue
+0
-56
index.vue
src/components/ErrorLog/index.vue
+77
-0
errorLog.js
src/errorLog.js
+12
-11
errorLog.js
src/store/errorLog.js
+0
-0
errorTestA.vue
src/views/errorLog/errorTestA.vue
+6
-0
errorTestB.vue
src/views/errorLog/errorTestB.vue
+11
-0
index.vue
src/views/errorLog/index.vue
+10
-5
Navbar.vue
src/views/layout/components/Navbar.vue
+2
-2
No files found.
src/components/ErrLog/index.vue
deleted
100644 → 0
View file @
85492f14
<
template
>
<div>
<el-badge
:is-dot=
"true"
style=
"line-height: 30px;"
@
click
.
native=
"dialogTableVisible=true"
>
<el-button
size=
"small"
type=
"primary"
>
<svg
t=
"1492682037685"
class=
"bug-svg"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"1863"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"64"
height=
"64"
>
<path
d=
"M969.142857 548.571429q0 14.848-10.861714 25.709714t-25.709714 10.861714l-128 0q0 97.718857-38.290286 165.705143l118.857143 119.442286q10.861714 10.861714 10.861714 25.709714t-10.861714 25.709714q-10.276571 10.861714-25.709714 10.861714t-25.709714-10.861714l-113.152-112.566857q-2.852571 2.852571-8.557714 7.424t-23.990857 16.274286-37.156571 20.845714-46.848 16.566857-55.442286 7.424l0-512-73.142857 0 0 512q-29.147429 0-58.002286-7.716571t-49.700571-18.870857-37.705143-22.272-24.868571-18.578286l-8.557714-8.009143-104.557714 118.272q-11.446857 11.995429-27.428571 11.995429-13.714286 0-24.576-9.142857-10.861714-10.276571-11.702857-25.417143t8.850286-26.587429l115.419429-129.718857q-33.133714-65.133714-33.133714-156.562286l-128 0q-14.848 0-25.709714-10.861714t-10.861714-25.709714 10.861714-25.709714 25.709714-10.861714l128 0 0-168.009143-98.852571-98.852571q-10.861714-10.861714-10.861714-25.709714t10.861714-25.709714 25.709714-10.861714 25.709714 10.861714l98.852571 98.852571 482.304 0 98.852571-98.852571q10.861714-10.861714 25.709714-10.861714t25.709714 10.861714 10.861714 25.709714-10.861714 25.709714l-98.852571 98.852571 0 168.009143 128 0q14.848 0 25.709714 10.861714t10.861714 25.709714zM694.857143 219.428571l-365.714286 0q0-75.995429 53.430857-129.426286t129.426286-53.430857 129.426286 53.430857 53.430857 129.426286z"
p-id=
"1864"
></path>
</svg>
</el-button>
</el-badge>
<el-dialog
title=
"bug日志"
:visible
.
sync=
"dialogTableVisible"
>
<el-table
:data=
"logsList"
>
<el-table-column
label=
"message"
>
<template
slot-scope=
"scope"
>
<div>
msg:
{{
scope
.
row
.
err
.
message
}}
</div>
<br/>
<div>
url:
{{
scope
.
row
.
url
}}
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"stack"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
err
.
stack
}}
</
template
>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<
script
>
export
default
{
name
:
'errLog'
,
props
:
{
logsList
:
{
type
:
Array
}
},
data
()
{
return
{
dialogTableVisible
:
false
}
}
}
</
script
>
<
style
scoped
>
.bug-svg
{
width
:
1em
;
height
:
1em
;
vertical-align
:
-0.15em
;
fill
:
currentColor
;
overflow
:
hidden
;
}
</
style
>
src/components/ErrorLog/index.vue
0 → 100644
View file @
f9aaaa90
<
template
>
<div>
<el-badge
:is-dot=
"true"
style=
"line-height: 30px;"
@
click
.
native=
"dialogTableVisible=true"
>
<el-button
size=
"small"
type=
"danger"
class=
"bug-btn"
>
<svg
t=
"1492682037685"
class=
"bug-svg"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"1863"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"128"
height=
"128"
>
<path
d=
"M969.142857 548.571429q0 14.848-10.861714 25.709714t-25.709714 10.861714l-128 0q0 97.718857-38.290286 165.705143l118.857143 119.442286q10.861714 10.861714 10.861714 25.709714t-10.861714 25.709714q-10.276571 10.861714-25.709714 10.861714t-25.709714-10.861714l-113.152-112.566857q-2.852571 2.852571-8.557714 7.424t-23.990857 16.274286-37.156571 20.845714-46.848 16.566857-55.442286 7.424l0-512-73.142857 0 0 512q-29.147429 0-58.002286-7.716571t-49.700571-18.870857-37.705143-22.272-24.868571-18.578286l-8.557714-8.009143-104.557714 118.272q-11.446857 11.995429-27.428571 11.995429-13.714286 0-24.576-9.142857-10.861714-10.276571-11.702857-25.417143t8.850286-26.587429l115.419429-129.718857q-33.133714-65.133714-33.133714-156.562286l-128 0q-14.848 0-25.709714-10.861714t-10.861714-25.709714 10.861714-25.709714 25.709714-10.861714l128 0 0-168.009143-98.852571-98.852571q-10.861714-10.861714-10.861714-25.709714t10.861714-25.709714 25.709714-10.861714 25.709714 10.861714l98.852571 98.852571 482.304 0 98.852571-98.852571q10.861714-10.861714 25.709714-10.861714t25.709714 10.861714 10.861714 25.709714-10.861714 25.709714l-98.852571 98.852571 0 168.009143 128 0q14.848 0 25.709714 10.861714t10.861714 25.709714zM694.857143 219.428571l-365.714286 0q0-75.995429 53.430857-129.426286t129.426286-53.430857 129.426286 53.430857 53.430857 129.426286z"
p-id=
"1864"
></path>
</svg>
</el-button>
</el-badge>
<el-dialog
title=
"Error Log"
:visible
.
sync=
"dialogTableVisible"
width=
"80%"
>
<el-table
:data=
"logsList"
border
>
<el-table-column
label=
"Message"
>
<template
slot-scope=
"scope"
>
<div>
<span
class=
"message-title"
>
Msg:
</span>
<el-tag
type=
"danger"
>
{{
scope
.
row
.
err
.
message
}}
</el-tag>
</div>
<br/>
<div>
<span
class=
"message-title"
style=
"padding-right: 10px;"
>
Info:
</span>
<el-tag
type=
"warning"
>
{{
scope
.
row
.
vm
.
$vnode
.
tag
}}
error in
{{
scope
.
row
.
info
}}
</el-tag>
</div>
<br/>
<div>
<span
class=
"message-title"
style=
"padding-right: 16px;"
>
Url:
</span>
<el-tag
type=
"success"
>
{{
scope
.
row
.
url
}}
</el-tag>
</div>
</
template
>
</el-table-column>
<el-table-column
label=
"Stack"
>
<
template
slot-scope=
"scope"
>
{{
scope
.
row
.
err
.
stack
}}
</
template
>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<
script
>
export
default
{
name
:
'errorLog'
,
props
:
{
logsList
:
{
type
:
Array
}
},
data
()
{
return
{
dialogTableVisible
:
false
}
}
}
</
script
>
<
style
scoped
>
.bug-btn.el-button--small
{
padding
:
9px
10px
;
}
.bug-svg
{
width
:
1em
;
height
:
1em
;
vertical-align
:
-0.15em
;
fill
:
currentColor
;
overflow
:
hidden
;
}
.message-title
{
font-size
:
16px
;
color
:
#333
;
font-weight
:
bold
;
padding-right
:
8px
;
}
</
style
>
src/errorLog.js
View file @
f9aaaa90
import
Vue
from
'vue'
import
Vue
from
'vue'
import
errLog
from
'@/store/errLog'
import
errLog
from
'@/store/err
or
Log'
//
生产环境错误日志
//
you can set only in production env show the error-log
if
(
process
.
env
.
NODE_ENV
===
'production'
)
{
//
if (process.env.NODE_ENV === 'production') {
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
)
{
Vue
.
config
.
errorHandler
=
function
(
err
,
vm
,
info
)
{
console
.
log
(
err
,
window
.
location
.
href
)
errLog
.
pushLog
({
err
Log
.
pushLog
({
err
,
err
,
vm
,
url
:
window
.
location
.
href
,
info
,
vm
url
:
window
.
location
.
href
})
})
}
console
.
error
(
err
,
info
)
}
}
// }
src/store/errLog.js
→
src/store/err
or
Log.js
View file @
f9aaaa90
File moved
src/views/errorLog/err
code
.vue
→
src/views/errorLog/err
orTestA
.vue
View file @
f9aaaa90
...
@@ -5,3 +5,9 @@
...
@@ -5,3 +5,9 @@
<!--error code-->
<!--error code-->
</div>
</div>
</
template
>
</
template
>
<
script
>
export
default
{
name
:
'errorTestA'
}
</
script
>
src/views/errorLog/errorTestB.vue
0 → 100644
View file @
f9aaaa90
<
template
>
<div></div>
</
template
>
<
script
>
export
default
{
created
()
{
this
.
b
=
b
// eslint-disable-line
}
}
</
script
>
src/views/errorLog/index.vue
View file @
f9aaaa90
<
template
>
<
template
>
<div
class=
"errPage-container"
>
<div
class=
"errPage-container"
>
<err-code></err-code>
<errorA></errorA>
<errorB></errorB>
<h3>
请点击右上角bug小图表
</h3>
<h3>
请点击右上角bug小图表
</h3>
<code>
<code>
现在的管理后台基本都是spa的形式了,它增强了用户体验,但同时也会增加页面出问题的可能性,可能一个小小的疏忽就导致整个页面的死锁。好在Vue官网提供了一个方法来捕获处理异常
现在的管理后台基本都是spa的形式了,它增强了用户体验,但同时也会增加页面出问题的可能性,可能一个小小的疏忽就导致整个页面的死锁。好在 Vue 官网提供了一个方法来捕获处理异常.
<a
target=
"_blank"
class=
"link-type"
href=
"https://panjiachen.github.io/vue-element-admin-site/#/error?id=%e4%bb%a3%e7%a0%81"
>
文档介绍
</a>
</code>
</code>
<a
href=
"#"
><img
src=
'http://panjiachen.github.io/images/errHandler.png'
></a>
<a
href=
"#"
>
<img
src=
'https://wpimg.wallstcn.com/360e4842-4db5-42d0-b078-f9a84a825546.gif'
>
</a>
</div>
</div>
</
template
>
</
template
>
<
script
>
<
script
>
import
errCode
from
'./errcode'
import
errorA
from
'./errorTestA'
import
errorB
from
'./errorTestB'
export
default
{
export
default
{
name
:
'errorLog'
,
name
:
'errorLog'
,
components
:
{
err
Code
}
components
:
{
err
orA
,
errorB
}
}
}
</
script
>
</
script
>
...
...
src/views/layout/components/Navbar.vue
View file @
f9aaaa90
...
@@ -57,8 +57,8 @@ import Breadcrumb from '@/components/Breadcrumb'
...
@@ -57,8 +57,8 @@ import Breadcrumb from '@/components/Breadcrumb'
import
Hamburger
from
'@/components/Hamburger'
import
Hamburger
from
'@/components/Hamburger'
import
ThemePicker
from
'@/components/ThemePicker'
import
ThemePicker
from
'@/components/ThemePicker'
import
Screenfull
from
'@/components/Screenfull'
import
Screenfull
from
'@/components/Screenfull'
import
ErrorLog
from
'@/components/ErrLog'
import
ErrorLog
from
'@/components/Err
or
Log'
import
errLogStore
from
'
store/er
rLog'
import
errLogStore
from
'
@/store/erro
rLog'
export
default
{
export
default
{
components
:
{
components
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment