Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ant-design-pro-vue
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
tianzhuanghu
ant-design-pro-vue
Commits
d310d2f4
Unverified
Commit
d310d2f4
authored
Jan 20, 2019
by
Sendya
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: login enter submit, username user-select:none
parent
10dc997e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
85 additions
and
82 deletions
+85
-82
GlobalLayout.vue
src/components/page/GlobalLayout.vue
+5
-0
UserMenu.vue
src/components/tools/UserMenu.vue
+76
-80
Login.vue
src/views/user/Login.vue
+4
-2
No files found.
src/components/page/GlobalLayout.vue
View file @
d310d2f4
...
...
@@ -551,6 +551,11 @@
}
//
外置的样式控制
.user-dropdown-menu
{
span
{
user-select
:
none
;
}
}
.user-dropdown-menu-wrapper.ant-dropdown-menu
{
padding
:
4px
0
;
...
...
src/components/tools/UserMenu.vue
View file @
d310d2f4
<
template
>
<div
class=
"user-wrapper"
>
<span
class=
"action"
>
<a-icon
type=
"question-circle-o"
></a-icon>
</span>
<header-notice
class=
"action"
/>
<a-dropdown>
<span
class=
"action ant-dropdown-link user-dropdown-menu"
>
<a-avatar
class=
"avatar"
size=
"small"
:src=
"avatar()"
/>
<span>
{{
nickname
()
}}
</span>
</span>
<a-menu
slot=
"overlay"
class=
"user-dropdown-menu-wrapper"
>
<a-menu-item
key=
"0"
>
<router-link
:to=
"
{ name: 'center' }">
<a-icon
type=
"user"
/>
<span>
个人中心
</span>
</router-link>
</a-menu-item>
<a-menu-item
key=
"1"
>
<router-link
:to=
"
{ name: 'settings' }">
<a-icon
type=
"setting"
/>
<span>
账户设置
</span>
</router-link>
</a-menu-item>
<a-menu-item
key=
"2"
disabled
>
<a-icon
type=
"setting"
/>
<span>
测试
</span>
</a-menu-item>
<a-menu-divider/>
<a-menu-item
key=
"3"
>
<a
href=
"javascript:;"
@
click=
"handleLogout"
>
<a-icon
type=
"logout"
/>
<span>
退出登录
</span>
</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</div>
</
template
>
<
script
>
import
HeaderNotice
from
'./HeaderNotice'
import
{
mapActions
,
mapGetters
}
from
'vuex'
export
default
{
name
:
'UserMenu'
,
components
:
{
HeaderNotice
},
methods
:
{
...
mapActions
([
'Logout'
]),
...
mapGetters
([
'nickname'
,
'avatar'
]),
handleLogout
()
{
const
that
=
this
this
.
$confirm
({
title
:
'提示'
,
content
:
'真的要注销登录吗 ?'
,
onOk
()
{
return
that
.
Logout
({}).
then
(()
=>
{
window
.
location
.
reload
()
}).
catch
(
err
=>
{
that
.
$message
.
error
({
title
:
'错误'
,
description
:
err
.
message
})
})
},
onCancel
()
{
},
})
},
}
}
</
script
>
<
style
scoped
>
</
style
>
\ No newline at end of file
<
template
>
<div
class=
"user-wrapper"
>
<span
class=
"action"
>
<a-icon
type=
"question-circle-o"
></a-icon>
</span>
<header-notice
class=
"action"
/>
<a-dropdown>
<span
class=
"action ant-dropdown-link user-dropdown-menu"
>
<a-avatar
class=
"avatar"
size=
"small"
:src=
"avatar()"
/>
<span>
{{
nickname
()
}}
</span>
</span>
<a-menu
slot=
"overlay"
class=
"user-dropdown-menu-wrapper"
>
<a-menu-item
key=
"0"
>
<router-link
:to=
"
{ name: 'center' }">
<a-icon
type=
"user"
/>
<span>
个人中心
</span>
</router-link>
</a-menu-item>
<a-menu-item
key=
"1"
>
<router-link
:to=
"
{ name: 'settings' }">
<a-icon
type=
"setting"
/>
<span>
账户设置
</span>
</router-link>
</a-menu-item>
<a-menu-item
key=
"2"
disabled
>
<a-icon
type=
"setting"
/>
<span>
测试
</span>
</a-menu-item>
<a-menu-divider/>
<a-menu-item
key=
"3"
>
<a
href=
"javascript:;"
@
click=
"handleLogout"
>
<a-icon
type=
"logout"
/>
<span>
退出登录
</span>
</a>
</a-menu-item>
</a-menu>
</a-dropdown>
</div>
</
template
>
<
script
>
import
HeaderNotice
from
'./HeaderNotice'
import
{
mapActions
,
mapGetters
}
from
'vuex'
export
default
{
name
:
'UserMenu'
,
components
:
{
HeaderNotice
},
methods
:
{
...
mapActions
([
'Logout'
]),
...
mapGetters
([
'nickname'
,
'avatar'
]),
handleLogout
()
{
const
that
=
this
this
.
$confirm
({
title
:
'提示'
,
content
:
'真的要注销登录吗 ?'
,
onOk
()
{
return
that
.
Logout
({}).
then
(()
=>
{
window
.
location
.
reload
()
}).
catch
(
err
=>
{
that
.
$message
.
error
({
title
:
'错误'
,
description
:
err
.
message
})
})
},
onCancel
()
{
},
})
},
}
}
</
script
>
\ No newline at end of file
src/views/user/Login.vue
View file @
d310d2f4
...
...
@@ -5,6 +5,7 @@
class=
"user-layout-login"
ref=
"formLogin"
:form=
"form"
@
submit=
"handleSubmit"
>
<a-tabs
:activeKey=
"customActiveKey"
...
...
@@ -82,10 +83,10 @@
<a-button
size=
"large"
type=
"primary"
htmlType=
"submit"
class=
"login-button"
:loading=
"state.loginBtn"
:disabled=
"state.loginBtn"
@
click
.
stop
.
prevent=
"handleSubmit"
>
确定
</a-button>
</a-form-item>
...
...
@@ -169,7 +170,8 @@ export default {
this
.
customActiveKey
=
key
// this.form.resetFields()
},
handleSubmit
()
{
handleSubmit
(
e
)
{
e
.
preventDefault
()
const
{
form
:
{
validateFields
},
state
,
...
...
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