mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-12 04:06:53 +08:00
36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
|
|
||
|
import Vue from 'vue/dist/vue.esm';
|
||
|
import NavigatorContainer from '../../../vue/navigation/navigator.vue';
|
||
|
import PerfectScrollbar from 'vue2-perfect-scrollbar';
|
||
|
import 'vue2-perfect-scrollbar/dist/vue2-perfect-scrollbar.css';
|
||
|
|
||
|
Vue.use(PerfectScrollbar);
|
||
|
|
||
|
Vue.prototype.i18n = window.I18n;
|
||
|
|
||
|
window.addEventListener('DOMContentLoaded', () => {
|
||
|
const navigator = new Vue({
|
||
|
el: '#sciNavigationNavigatorContainer',
|
||
|
components: {
|
||
|
'navigator-container': NavigatorContainer
|
||
|
},
|
||
|
data() {
|
||
|
return {
|
||
|
navigatorCollapsed: false,
|
||
|
}
|
||
|
},
|
||
|
created() {
|
||
|
this.navigatorCollapsed = $('.sci--layout').attr('data-navigator-collapsed');
|
||
|
},
|
||
|
watch: {
|
||
|
navigatorCollapsed: function () {
|
||
|
let stateUrl = $('#sciNavigationNavigatorContainer').attr('data-navigator-state-url');
|
||
|
$('.sci--layout').attr('data-navigator-collapsed', this.navigatorCollapsed);
|
||
|
$.post(stateUrl, {state: this.navigatorCollapsed ? 'collapsed' : 'open'});
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
window.navigatorContainer = navigator
|
||
|
});
|