Skip to content

LanguageSwitcher currentUrl fixed for vue3 #29

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion dist/lang-router.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ var script = {
name: 'LanguageSwitcher',
data: function data () {
return {
currentUrl: this.url || this.$router.currentRoute.fullPath,
currentUrl: this.url || this.$router.currentRoute.fullPath || this.$router.currentRoute.value.fullPath,
links: [],
};
},
Expand Down
14 changes: 7 additions & 7 deletions dist/lang-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ var LangRouter = (function (exports, VueI18n, VueRouter) {
name: 'LanguageSwitcher',
data: function data () {
return {
currentUrl: this.url || this.$router.currentRoute.fullPath,
currentUrl: this.url || this.$router.currentRoute.fullPath || this.$router.currentRoute.value.fullPath,
links: [],
};
},
Expand Down Expand Up @@ -240,7 +240,7 @@ var LangRouter = (function (exports, VueI18n, VueRouter) {
addAliasesToRoutes(options.routes, lang$1);
}
}
var router = new VueRouter__default['default'](options);
var router = new VueRouter__default["default"](options);
router.beforeEach(switchLanguage);
return router;
};
Expand All @@ -266,8 +266,8 @@ var LangRouter = (function (exports, VueI18n, VueRouter) {
if (typeof defaultLanguage !== 'string') {
err('options.defaultLanguage should be a string, received ' + typeof defaultLanguage + ' instead.');
}
Vue.use(VueI18n__default['default']);
Vue.use(VueRouter__default['default']);
Vue.use(VueI18n__default["default"]);
Vue.use(VueRouter__default["default"]);
var messages = {};
for (var lang in translations) {
if (translations.hasOwnProperty(lang)) {
Expand All @@ -278,7 +278,7 @@ var LangRouter = (function (exports, VueI18n, VueRouter) {
}
}
}
exports.i18n = new VueI18n__default['default'](_spread({}, {locale: defaultLanguage,
exports.i18n = new VueI18n__default["default"](_spread({}, {locale: defaultLanguage,
fallbackLocale: defaultLanguage,
messages: messages},
options.i18nOptions));
Expand Down Expand Up @@ -407,10 +407,10 @@ var LangRouter = (function (exports, VueI18n, VueRouter) {
window.Vue.use(LangRouter);
}

exports['default'] = LangRouter;
exports["default"] = LangRouter;

Object.defineProperty(exports, '__esModule', { value: true });

return exports;

}({}, VueI18n, VueRouter));
})({}, VueI18n, VueRouter);
2 changes: 1 addition & 1 deletion dist/lang-router.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions dist/lang-router.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vue-i18n'), require('vue-router')) :
typeof define === 'function' && define.amd ? define(['exports', 'vue-i18n', 'vue-router'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.LangRouter = {}, global.VueI18n, global.VueRouter));
}(this, (function (exports, VueI18n, VueRouter) { 'use strict';
})(this, (function (exports, VueI18n, VueRouter) { 'use strict';

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

Expand Down Expand Up @@ -152,7 +152,7 @@
name: 'LanguageSwitcher',
data: function data () {
return {
currentUrl: this.url || this.$router.currentRoute.fullPath,
currentUrl: this.url || this.$router.currentRoute.fullPath || this.$router.currentRoute.value.fullPath,
links: [],
};
},
Expand Down Expand Up @@ -243,7 +243,7 @@
addAliasesToRoutes(options.routes, lang$1);
}
}
var router = new VueRouter__default['default'](options);
var router = new VueRouter__default["default"](options);
router.beforeEach(switchLanguage);
return router;
};
Expand All @@ -269,8 +269,8 @@
if (typeof defaultLanguage !== 'string') {
err('options.defaultLanguage should be a string, received ' + typeof defaultLanguage + ' instead.');
}
Vue.use(VueI18n__default['default']);
Vue.use(VueRouter__default['default']);
Vue.use(VueI18n__default["default"]);
Vue.use(VueRouter__default["default"]);
var messages = {};
for (var lang in translations) {
if (translations.hasOwnProperty(lang)) {
Expand All @@ -281,7 +281,7 @@
}
}
}
exports.i18n = new VueI18n__default['default'](_spread({}, {locale: defaultLanguage,
exports.i18n = new VueI18n__default["default"](_spread({}, {locale: defaultLanguage,
fallbackLocale: defaultLanguage,
messages: messages},
options.i18nOptions));
Expand Down Expand Up @@ -410,8 +410,8 @@
window.Vue.use(LangRouter);
}

exports['default'] = LangRouter;
exports["default"] = LangRouter;

Object.defineProperty(exports, '__esModule', { value: true });

})));
}));
2 changes: 1 addition & 1 deletion src/plugin/components/LanguageSwitcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default {
name: 'LanguageSwitcher',
data () {
return {
currentUrl: this.url || this.$router.currentRoute.fullPath,
currentUrl: this.url || this.$router.currentRoute.fullPath || this.$router.currentRoute.value.fullPath,
links: [],
};
},
Expand Down