Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Autofocus to input #81

Merged
merged 1 commit into from
Sep 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/assets/js/event/directive-register.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default (Vue) => {
Vue.directive('focus', {
inserted: function (el) {
el.focus()
}
});
}
1 change: 1 addition & 0 deletions src/components/PasswordAuth.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<b-form-input
type="password"
v-model="form.password"
v-focus
:placeholder="flag ? '' : this.$t('lang.auth.form.placeholder')">
</b-form-input>
</b-form-group>
Expand Down
4 changes: 3 additions & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ import router from './assets/js/router'
import store from './assets/js/store'
import i18n from './assets/js/i18n'
import api from './assets/js/api'
import markdownIt from './assets/js/external/markdownIt'
import markdownIt from './assets/js/external/markdown-it'
import DirectiveRegister from './assets/js/event/directive-register'

import '@/assets/css/global.css'

let VueCookie = require('vue-cookie');
DirectiveRegister(Vue);
Vue.config.productionTip = false;
Vue.use(BootstrapVue);
Vue.use(VueCookie);
Expand Down