1
0
mirror of https://github.com/PanJiaChen/vue-element-admin.git synced 2025-09-08 03:01:56 +08:00

merge master

This commit is contained in:
Pan 2019-04-01 16:51:54 +08:00
commit 4a2efc2c6c
3 changed files with 15 additions and 2 deletions

View File

@ -30,7 +30,7 @@
## 简介 ## 简介
[vue-element-admin](http://panjiachen.github.io/vue-element-admin) 是一个后台前端解决方案,它基于 [vue](https://github.com/vuejs/vue) 和 [element-ui](https://github.com/ElemeFE/element)实现。它使用了最新的前端技术栈,内置了 i18 国际化解决方案,动态路由,权限验证,提炼了典型的业务模型,提供了丰富的功能组件,它可以帮助你快速搭建企业级中后台产品原型。相信不管你的需求是什么,本项目都能帮助到你。 [vue-element-admin](http://panjiachen.github.io/vue-element-admin) 是一个后台前端解决方案,它基于 [vue](https://github.com/vuejs/vue) 和 [element-ui](https://github.com/ElemeFE/element)实现。它使用了最新的前端技术栈,内置了 i18n 国际化解决方案,动态路由,权限验证,提炼了典型的业务模型,提供了丰富的功能组件,它可以帮助你快速搭建企业级中后台产品原型。相信不管你的需求是什么,本项目都能帮助到你。
- [在线预览](http://panjiachen.github.io/vue-element-admin) - [在线预览](http://panjiachen.github.io/vue-element-admin)

View File

@ -11,6 +11,7 @@ export function mockXHR() {
Mock.XHR.prototype.send = function() { Mock.XHR.prototype.send = function() {
if (this.custom.xhr) { if (this.custom.xhr) {
this.custom.xhr.withCredentials = this.withCredentials || false this.custom.xhr.withCredentials = this.withCredentials || false
this.custom.xhr.responseType = this.responseType
} }
this.proxy_send(...arguments) this.proxy_send(...arguments)
} }

View File

@ -14,6 +14,7 @@
<svg-icon icon-class="user" /> <svg-icon icon-class="user" />
</span> </span>
<el-input <el-input
ref="username"
v-model="loginForm.username" v-model="loginForm.username"
:placeholder="$t('login.username')" :placeholder="$t('login.username')"
name="username" name="username"
@ -28,6 +29,7 @@
</span> </span>
<el-input <el-input
:key="passwordType" :key="passwordType"
ref="password"
v-model="loginForm.password" v-model="loginForm.password"
:type="passwordType" :type="passwordType"
:placeholder="$t('login.password')" :placeholder="$t('login.password')"
@ -98,7 +100,7 @@ export default {
return { return {
loginForm: { loginForm: {
username: 'admin', username: 'admin',
password: '1111111' password: '111111'
}, },
loginRules: { loginRules: {
username: [{ required: true, trigger: 'blur', validator: validateUsername }], username: [{ required: true, trigger: 'blur', validator: validateUsername }],
@ -121,6 +123,13 @@ export default {
created() { created() {
// window.addEventListener('storage', this.afterQRScan) // window.addEventListener('storage', this.afterQRScan)
}, },
mounted() {
if (this.loginForm.username === '') {
this.$refs.username.focus()
} else if (this.loginForm.password === '') {
this.$refs.password.focus()
}
},
destroyed() { destroyed() {
// window.removeEventListener('storage', this.afterQRScan) // window.removeEventListener('storage', this.afterQRScan)
}, },
@ -131,6 +140,9 @@ export default {
} else { } else {
this.passwordType = 'password' this.passwordType = 'password'
} }
this.$nextTick(() => {
this.$refs.password.focus()
})
}, },
handleLogin() { handleLogin() {
this.$refs.loginForm.validate(valid => { this.$refs.loginForm.validate(valid => {