debian-mirror-gitlab/app/assets/javascripts/vue_shared/components/url_sync.vue

26 lines
497 B
Vue
Raw Normal View History

2020-06-23 00:09:42 +05:30
<script>
import { historyPushState } from '~/lib/utils/common_utils';
2020-11-24 15:15:51 +05:30
import { mergeUrlParams } from '~/lib/utils/url_utility';
2020-06-23 00:09:42 +05:30
export default {
props: {
query: {
type: Object,
required: true,
},
},
watch: {
query: {
immediate: true,
deep: true,
handler(newQuery) {
2020-11-24 15:15:51 +05:30
historyPushState(mergeUrlParams(newQuery, window.location.href, { spreadArrays: true }));
2020-06-23 00:09:42 +05:30
},
},
},
render() {
return this.$slots.default;
},
};
</script>