From d32e526de0db438141e6ce7b1e22316714a13382 Mon Sep 17 00:00:00 2001 From: Nicolas Widart <n.widart@gmail.com> Date: Sun, 17 Sep 2017 20:17:43 +0200 Subject: [PATCH] Set the active tab to the active language --- Modules/Page/Assets/js/components/PageForm.vue | 5 +++-- public/js/app.js | 13 +++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Modules/Page/Assets/js/components/PageForm.vue b/Modules/Page/Assets/js/components/PageForm.vue index 3a3d53c8..f9393c30 100644 --- a/Modules/Page/Assets/js/components/PageForm.vue +++ b/Modules/Page/Assets/js/components/PageForm.vue @@ -22,9 +22,9 @@ <div class="col-md-10"> <div class="box box-primary"> <div class="box-body"> - <el-tabs type="card"> + <el-tabs type="card" v-model="activeTab"> <el-tab-pane :label="localeArray.name" v-for="(localeArray, locale) in locales" - :key="localeArray.name"> + :key="localeArray.name" :name="locale"> <span slot="label" :class="{'error' : form.errors.has(locale)}">{{ localeArray.name }}</span> <el-form-item :label="trans('page.title')" @@ -186,6 +186,7 @@ form: new Form(), loading: false, tags: {}, + activeTab: window.AsgardCMS.currentLocale || 'en', } }, methods: { diff --git a/public/js/app.js b/public/js/app.js index 4d87b5b9..a12f93ea 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -73167,7 +73167,8 @@ exports.default = { }, form: new _formBackendValidation2.default(), loading: false, - tags: {} + tags: {}, + activeTab: window.AsgardCMS.currentLocale || 'en' }; }, @@ -73856,12 +73857,20 @@ module.exports={render:function (){var _vm=this;var _h=_vm.$createElement;var _c }, [_c('el-tabs', { attrs: { "type": "card" + }, + model: { + value: (_vm.activeTab), + callback: function($$v) { + _vm.activeTab = $$v + }, + expression: "activeTab" } }, _vm._l((_vm.locales), function(localeArray, locale) { return _c('el-tab-pane', { key: localeArray.name, attrs: { - "label": localeArray.name + "label": localeArray.name, + "name": locale } }, [_c('span', { class: { -- 2.21.0