Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
一臭打代码的 aka 潘先生です
vue-vben-admin
提交
814f9a7a
V
vue-vben-admin
项目概览
一臭打代码的 aka 潘先生です
/
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,发现更多精彩内容 >>
提交
814f9a7a
编写于
11月 21, 2020
作者:
V
vben
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: update deps
上级
16117a9e
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
155 addition
and
68 deletion
+155
-68
package.json
package.json
+5
-5
src/router/index.ts
src/router/index.ts
+2
-13
src/router/scrollBehaviour.ts
src/router/scrollBehaviour.ts
+58
-0
src/utils/eventHub.ts
src/utils/eventHub.ts
+0
-33
src/utils/mitt.ts
src/utils/mitt.ts
+73
-0
yarn.lock
yarn.lock
+17
-17
未找到文件。
package.json
浏览文件 @
814f9a7a
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
},
},
"dependencies"
:
{
"dependencies"
:
{
"
@iconify/iconify
"
:
"
^2.0.0-rc.2
"
,
"
@iconify/iconify
"
:
"
^2.0.0-rc.2
"
,
"
@vueuse/core
"
:
"
4.0.0-rc.3
"
,
"
@vueuse/core
"
:
"
^
4.0.0-rc.3
"
,
"
ant-design-vue
"
:
"
2.0.0-beta.15
"
,
"
ant-design-vue
"
:
"
2.0.0-beta.15
"
,
"
apexcharts
"
:
"
3.22.0
"
,
"
apexcharts
"
:
"
3.22.0
"
,
"
axios
"
:
"
^0.21.0
"
,
"
axios
"
:
"
^0.21.0
"
,
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
"
nprogress
"
:
"
^0.2.0
"
,
"
nprogress
"
:
"
^0.2.0
"
,
"
path-to-regexp
"
:
"
^6.2.0
"
,
"
path-to-regexp
"
:
"
^6.2.0
"
,
"
qrcode
"
:
"
^1.4.4
"
,
"
qrcode
"
:
"
^1.4.4
"
,
"
vditor
"
:
"
^3.6.
2
"
,
"
vditor
"
:
"
^3.6.
3
"
,
"
vue
"
:
"
^3.0.2
"
,
"
vue
"
:
"
^3.0.2
"
,
"
vue-i18n
"
:
"
^9.0.0-beta.8
"
,
"
vue-i18n
"
:
"
^9.0.0-beta.8
"
,
"
vue-router
"
:
"
^4.0.0-rc.3
"
,
"
vue-router
"
:
"
^4.0.0-rc.3
"
,
...
@@ -45,7 +45,7 @@
...
@@ -45,7 +45,7 @@
"devDependencies"
:
{
"devDependencies"
:
{
"
@commitlint/cli
"
:
"
^11.0.0
"
,
"
@commitlint/cli
"
:
"
^11.0.0
"
,
"
@commitlint/config-conventional
"
:
"
^11.0.0
"
,
"
@commitlint/config-conventional
"
:
"
^11.0.0
"
,
"
@iconify/json
"
:
"
^1.1.26
0
"
,
"
@iconify/json
"
:
"
^1.1.26
1
"
,
"
@ls-lint/ls-lint
"
:
"
^1.9.2
"
,
"
@ls-lint/ls-lint
"
:
"
^1.9.2
"
,
"
@purge-icons/generated
"
:
"
^0.4.1
"
,
"
@purge-icons/generated
"
:
"
^0.4.1
"
,
"
@types/echarts
"
:
"
^4.9.1
"
,
"
@types/echarts
"
:
"
^4.9.1
"
,
...
@@ -69,7 +69,7 @@
...
@@ -69,7 +69,7 @@
"
conventional-changelog-cli
"
:
"
^2.1.1
"
,
"
conventional-changelog-cli
"
:
"
^2.1.1
"
,
"
conventional-changelog-custom-config
"
:
"
^0.3.1
"
,
"
conventional-changelog-custom-config
"
:
"
^0.3.1
"
,
"
cross-env
"
:
"
^7.0.2
"
,
"
cross-env
"
:
"
^7.0.2
"
,
"
dot-prop
"
:
"
^6.0.
0
"
,
"
dot-prop
"
:
"
^6.0.
1
"
,
"
dotenv
"
:
"
^8.2.0
"
,
"
dotenv
"
:
"
^8.2.0
"
,
"
eslint
"
:
"
^7.13.0
"
,
"
eslint
"
:
"
^7.13.0
"
,
"
eslint-config-prettier
"
:
"
^6.15.0
"
,
"
eslint-config-prettier
"
:
"
^6.15.0
"
,
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
"
stylelint-order
"
:
"
^4.1.0
"
,
"
stylelint-order
"
:
"
^4.1.0
"
,
"
tasksfile
"
:
"
^5.1.1
"
,
"
tasksfile
"
:
"
^5.1.1
"
,
"
ts-node
"
:
"
^9.0.0
"
,
"
ts-node
"
:
"
^9.0.0
"
,
"
typescript
"
:
"
^4.
0.5
"
,
"
typescript
"
:
"
^4.
1.2
"
,
"
vite
"
:
"
^1.0.0-rc.9
"
,
"
vite
"
:
"
^1.0.0-rc.9
"
,
"
vite-plugin-html
"
:
"
^1.0.0-beta.2
"
,
"
vite-plugin-html
"
:
"
^1.0.0-beta.2
"
,
"
vite-plugin-mock
"
:
"
^1.0.6
"
,
"
vite-plugin-mock
"
:
"
^1.0.6
"
,
...
...
src/router/index.ts
浏览文件 @
814f9a7a
...
@@ -3,28 +3,17 @@ import type { App } from 'vue';
...
@@ -3,28 +3,17 @@ import type { App } from 'vue';
import
{
createRouter
,
createWebHashHistory
}
from
'
vue-router
'
;
import
{
createRouter
,
createWebHashHistory
}
from
'
vue-router
'
;
import
{
scrollWaiter
}
from
'
./scrollWaiter
'
;
import
{
createGuard
}
from
'
./guard/
'
;
import
{
createGuard
}
from
'
./guard/
'
;
import
{
basicRoutes
}
from
'
./routes/
'
;
import
{
basicRoutes
}
from
'
./routes/
'
;
import
{
scrollBehavior
}
from
'
./scrollBehaviour
'
;
// app router
// app router
const
router
=
createRouter
({
const
router
=
createRouter
({
history
:
createWebHashHistory
(),
history
:
createWebHashHistory
(),
routes
:
basicRoutes
as
RouteRecordRaw
[],
routes
:
basicRoutes
as
RouteRecordRaw
[],
strict
:
true
,
strict
:
true
,
scrollBehavior
:
async
(
to
,
from
,
savedPosition
)
=>
{
scrollBehavior
:
scrollBehavior
,
await
scrollWaiter
.
wait
();
if
(
savedPosition
)
{
return
savedPosition
;
}
else
{
if
(
to
.
matched
.
every
((
record
,
i
)
=>
from
.
matched
[
i
]
!==
record
))
{
return
{
left
:
0
,
top
:
0
};
}
return
false
;
}
},
});
});
// reset router
// reset router
...
...
src/router/scroll
Waite
r.ts
→
src/router/scroll
Behaviou
r.ts
浏览文件 @
814f9a7a
/**
* Handles the scroll behavior on route navigation
*
* @param {object} to Route object of next page
* @param {object} from Route object of previous page
* @param {object} savedPosition Used by popstate navigations
* @returns {(object|boolean)} Scroll position or `false`
*/
// @ts-ignore
export
async
function
scrollBehavior
(
to
,
from
,
savedPosition
)
{
await
scrollWaiter
.
wait
();
// Use predefined scroll behavior if defined, defaults to no scroll behavior
const
behavior
=
document
.
documentElement
.
style
.
scrollBehavior
||
'
auto
'
;
// Returning the `savedPosition` (if available) will result in a native-like
// behavior when navigating with back/forward buttons
if
(
savedPosition
)
{
return
{
...
savedPosition
,
behavior
};
}
// Scroll to anchor by returning the selector
if
(
to
.
hash
)
{
return
{
el
:
decodeURI
(
to
.
hash
),
behavior
};
}
// Check if any matched route config has meta that discourages scrolling to top
if
(
to
.
matched
.
some
((
m
:
any
)
=>
m
.
meta
.
scrollToTop
===
false
))
{
// Leave scroll as it is
return
false
;
}
// Always scroll to top
return
{
left
:
0
,
top
:
0
,
behavior
};
}
// see https://github.com/vuejs/vue-router-next/blob/master/playground/scrollWaiter.ts
// see https://github.com/vuejs/vue-router-next/blob/master/playground/scrollWaiter.ts
class
ScrollQueue
{
class
ScrollQueue
{
private
resolve
:
(()
=>
void
)
|
null
=
null
;
private
resolve
:
(()
=>
void
)
|
null
=
null
;
...
...
src/utils/eventHub.ts
已删除
100644 → 0
浏览文件 @
16117a9e
class
EventHub
{
private
cache
:
{
[
key
:
string
]:
Array
<
(
data
:
any
)
=>
void
>
}
=
{};
on
(
eventName
:
string
,
fn
:
(
data
:
any
)
=>
void
)
{
this
.
cache
[
eventName
]
=
this
.
cache
[
eventName
]
||
[];
this
.
cache
[
eventName
].
push
(
fn
);
}
once
(
eventName
:
string
,
fn
:
(
data
:
any
)
=>
void
)
{
const
decor
=
(...
args
:
any
[])
=>
{
fn
&&
fn
.
apply
(
this
,
args
);
this
.
off
(
eventName
,
decor
);
};
this
.
on
(
eventName
,
decor
);
return
this
;
}
emit
(
eventName
:
string
,
data
?:
any
)
{
if
(
this
.
cache
[
eventName
]
===
undefined
)
return
;
this
.
cache
[
eventName
].
forEach
((
fn
)
=>
fn
(
data
));
}
off
(
eventName
:
string
,
fn
:
(
data
:
any
)
=>
void
)
{
if
(
this
.
cache
[
eventName
]
===
undefined
||
this
.
cache
[
eventName
].
length
===
0
)
return
;
const
i
=
this
.
cache
[
eventName
].
indexOf
(
fn
);
if
(
i
===
-
1
)
return
;
this
.
cache
[
eventName
].
splice
(
i
,
1
);
}
clear
()
{
this
.
cache
=
{};
}
}
export
default
EventHub
;
src/utils/mitt.ts
0 → 100644
浏览文件 @
814f9a7a
/**
* Mitt: Tiny functional event emitter / pubsub
*
* @name mitt
* @param {Array} [all] Optional array of event names to registered handler functions
* @returns {Function} The function's instance
*/
export
default
class
Mitt
{
private
cache
:
Map
<
string
,
Array
<
(
data
:
any
)
=>
void
>>
;
constructor
(
all
=
[])
{
// A Map of event names to registered handler functions.
this
.
cache
=
new
Map
(
all
);
}
once
(
type
:
string
,
handler
:
Fn
)
{
const
decor
=
(...
args
:
any
[])
=>
{
handler
&&
handler
.
apply
(
this
,
args
);
this
.
off
(
type
,
decor
);
};
this
.
on
(
type
,
decor
);
return
this
;
}
/**
* Register an event handler for the given type.
*
* @param {string|symbol} type Type of event to listen for, or `"*"` for all events
* @param {Function} handler Function to call in response to given event
*/
on
(
type
:
string
,
handler
:
Fn
)
{
const
handlers
=
this
.
cache
.
get
(
type
);
const
added
=
handlers
&&
handlers
.
push
(
handler
);
if
(
!
added
)
{
this
.
cache
.
set
(
type
,
[
handler
]);
}
}
/**
* Remove an event handler for the given type.
*
* @param {string|symbol} type Type of event to unregister `handler` from, or `"*"`
* @param {Function} handler Handler function to remove
*/
off
(
type
:
string
,
handler
:
Fn
)
{
const
handlers
=
this
.
cache
.
get
(
type
);
if
(
handlers
)
{
handlers
.
splice
(
handlers
.
indexOf
(
handler
)
>>>
0
,
1
);
}
}
/**
* Invoke all handlers for the given type.
* If present, `"*"` handlers are invoked after type-matched handlers.
*
* Note: Manually firing "*" handlers is not supported.
*
* @param {string|symbol} type The event type to invoke
* @param {*} [evt] Any value (object is recommended and powerful), passed to each handler
*/
emit
(
type
:
string
,
evt
:
any
)
{
for
(
const
handler
of
(
this
.
cache
.
get
(
type
)
||
[]).
slice
())
handler
(
evt
);
for
(
const
handler
of
(
this
.
cache
.
get
(
'
*
'
)
||
[]).
slice
())
handler
(
type
,
evt
);
}
/**
* Remove all event handlers.
*
* Note: This will also remove event handlers passed via `mitt(all: EventHandlerMap)`.
*/
clear
()
{
this
.
cache
.
clear
();
}
}
yarn.lock
浏览文件 @
814f9a7a
...
@@ -1050,10 +1050,10 @@
...
@@ -1050,10 +1050,10 @@
resolved "https://registry.npmjs.org/@iconify/iconify/-/iconify-2.0.0-rc.2.tgz#c4a95ddc06ca9b9496df03604e66fdefb39f4c4b"
resolved "https://registry.npmjs.org/@iconify/iconify/-/iconify-2.0.0-rc.2.tgz#c4a95ddc06ca9b9496df03604e66fdefb39f4c4b"
integrity sha512-BybEHU5/I9EQ0CcwKAqmreZ2bMnAXrqLCTptAc6vPetHMbrXdZfejP5mt57e/8PNSt/qE7BHniU5PCYA+PGIHw==
integrity sha512-BybEHU5/I9EQ0CcwKAqmreZ2bMnAXrqLCTptAc6vPetHMbrXdZfejP5mt57e/8PNSt/qE7BHniU5PCYA+PGIHw==
"@iconify/json@^1.1.26
0
":
"@iconify/json@^1.1.26
1
":
version "1.1.26
0
"
version "1.1.26
1
"
resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.26
0.tgz#75bfcdcaf01f1a0092bb26f4ce7aebf357da431a
"
resolved "https://registry.npmjs.org/@iconify/json/-/json-1.1.26
1.tgz#9a6986b6b36d77ca147c4be149db9a43280a8fb2
"
integrity sha512-
gpRn0o55mvBTCcZRb8jBtqxV/5Av01BnnVn7/FyboBNdGkEQ8EMTqJL10SDUf9TLM8s63KKSg/ZeCJj870THt
A==
integrity sha512-
lnRk1OBqNxZ593oZyOXEMp/O+cr+lF54xaW6+F3krWdWhzxQgi0W1ffzvdiLySdbTEorQ2NvVU4e0+Af27rXP
A==
"@koa/cors@^3.1.0":
"@koa/cors@^3.1.0":
version "3.1.0"
version "3.1.0"
...
@@ -1737,7 +1737,7 @@
...
@@ -1737,7 +1737,7 @@
vscode-languageserver-textdocument "^1.0.1"
vscode-languageserver-textdocument "^1.0.1"
vscode-uri "^2.1.2"
vscode-uri "^2.1.2"
"@vueuse/core@4.0.0-rc.3":
"@vueuse/core@
^
4.0.0-rc.3":
version "4.0.0-rc.3"
version "4.0.0-rc.3"
resolved "https://registry.npmjs.org/@vueuse/core/-/core-4.0.0-rc.3.tgz#5381ca657e10df596cd7027fc5c96b2d4b3a090c"
resolved "https://registry.npmjs.org/@vueuse/core/-/core-4.0.0-rc.3.tgz#5381ca657e10df596cd7027fc5c96b2d4b3a090c"
integrity sha512-dQ/FZgo0z7kBFOvDWxuzaUrmuO8X1AlQk17e3PU1TVtG2Uu+mCvjPNbuvI2fjhTjl5rzPJawwoU2WZFj+nlFvw==
integrity sha512-dQ/FZgo0z7kBFOvDWxuzaUrmuO8X1AlQk17e3PU1TVtG2Uu+mCvjPNbuvI2fjhTjl5rzPJawwoU2WZFj+nlFvw==
...
@@ -3227,10 +3227,10 @@ dot-prop@^5.1.0:
...
@@ -3227,10 +3227,10 @@ dot-prop@^5.1.0:
dependencies:
dependencies:
is-obj "^2.0.0"
is-obj "^2.0.0"
dot-prop@^6.0.
0
:
dot-prop@^6.0.
1
:
version "6.0.
0
"
version "6.0.
1
"
resolved "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.
0.tgz#bd579fd704d970981c4b05de591db648959f2ebb
"
resolved "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.
1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083
"
integrity sha512-
xCbB8IN3IT+tdgoEPOnJmYTNJDrygGFOmiQEiVa5eAD+JEB1vTgMNhVGRnN5Eex/6amck7cdcrixb1qN9Go+GQ
==
integrity sha512-
tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA
==
dependencies:
dependencies:
is-obj "^2.0.0"
is-obj "^2.0.0"
...
@@ -7869,10 +7869,10 @@ typescript@^3.9.7:
...
@@ -7869,10 +7869,10 @@ typescript@^3.9.7:
resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
resolved "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
integrity sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==
typescript@^4.
0.5
:
typescript@^4.
1.2
:
version "4.
0.5
"
version "4.
1.2
"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.
0.5.tgz#ae9dddfd1069f1cb5beb3ef3b2170dd7c133238
9"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.
1.2.tgz#6369ef22516fe5e10304aae5a5c4862db55380e
9"
integrity sha512-
ywmr/VrTVCmNTJ6iV2LwIrfG1P+lv6luD8sUJs+2eI9NLGigaN+nUQc13iHqisq7bra9lnmUSYqbJvegraBOP
Q==
integrity sha512-
thGloWsGH3SOxv1SoY7QojKi0tc+8FnOmiarEGMbd/lar7QOEd3hvlx3Fp5y6FlDUGl9L+pd4n2e+oToGMmhR
Q==
uglify-js@^3.1.4:
uglify-js@^3.1.4:
version "3.11.6"
version "3.11.6"
...
@@ -8033,10 +8033,10 @@ vary@^1.1.2:
...
@@ -8033,10 +8033,10 @@ vary@^1.1.2:
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
resolved "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc"
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
integrity sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=
vditor@^3.6.
2
:
vditor@^3.6.
3
:
version "3.6.
2
"
version "3.6.
3
"
resolved "https://registry.npmjs.org/vditor/-/vditor-3.6.
2.tgz#ee6011efa3ec563c6356ed82efbf2e00ba2e35c6
"
resolved "https://registry.npmjs.org/vditor/-/vditor-3.6.
3.tgz#7d006f273208869b268268453b688ad4a0de8995
"
integrity sha512-
HPHHun5+IXmYGMKDWcUD83VfP1Qfncz7DmaIKoWpluJgE8ve7s+4RbFBcaEpYPXYzIuL2UTHoMnIjmTPbenOC
A==
integrity sha512-
skLJQrVBdeBFLdYVckfovCxNnzOR1vlgEesUFAc0WJdbfj/m4FHB7SY/LgV7KtoiK+crDPFrIdw3jkEQmhkFG
A==
dependencies:
dependencies:
diff-match-patch "^1.0.5"
diff-match-patch "^1.0.5"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录