|
@@ -28,7 +28,9 @@ import 'theme/assets/styles/main.scss'
|
|
|
|
|
|
var MaterioTheme = function(){
|
|
|
|
|
|
- var _v_sitebranding_block, _v_pagetitle_block, _v_user_block, _v_main_content, _v_search_block;
|
|
|
+ var _v_sitebranding_block, _v_user_block, _v_header_menu
|
|
|
+ , _v_pagetitle_block, _v_search_block
|
|
|
+ , _v_main_content;
|
|
|
var _is_front = drupalSettings.path.isFront;
|
|
|
|
|
|
console.log('drupalSettings', drupalSettings);
|
|
@@ -43,13 +45,29 @@ import 'theme/assets/styles/main.scss'
|
|
|
}
|
|
|
|
|
|
function initVues(){
|
|
|
+ initVRouter();
|
|
|
initVSiteBrandingBlock()
|
|
|
initVPagetitleBlock()
|
|
|
initVUserBlock()
|
|
|
+ initVHeaderMenu()
|
|
|
initVMainContent()
|
|
|
initVSearchBlock()
|
|
|
}
|
|
|
|
|
|
+ function initVRouter(){
|
|
|
+
|
|
|
+ router.beforeEach((to, from, next) => {
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ store.commit('Common/setPagetitle', to.name)
|
|
|
+ next();
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
function initVSiteBrandingBlock(){
|
|
|
_v_sitebranding_block = new Vue({
|
|
|
store,
|
|
@@ -61,7 +79,8 @@ import 'theme/assets/styles/main.scss'
|
|
|
let href = event.target.getAttribute('href');
|
|
|
|
|
|
this.$router.push(href)
|
|
|
- this.$store.commit('Common/setPagetitle', null)
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
})
|
|
@@ -127,6 +146,33 @@ import 'theme/assets/styles/main.scss'
|
|
|
|
|
|
}
|
|
|
|
|
|
+ function initVHeaderMenu(){
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ _v_header_menu = new Vue({
|
|
|
+ store,
|
|
|
+ router,
|
|
|
+ el: `#block-header`,
|
|
|
+ methods: {
|
|
|
+ onclick(event){
|
|
|
+
|
|
|
+ let href = event.target.getAttribute('href');
|
|
|
+ let title = event.target.innerText;
|
|
|
+
|
|
|
+ this.$router.push(href)
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
function initVMainContent(){
|
|
|
let id = "main-content"
|
|
|
let $main_content = document.querySelector('#'+id)
|
|
@@ -136,7 +182,6 @@ import 'theme/assets/styles/main.scss'
|
|
|
store,
|
|
|
render: h => h(VMainContent, {props:{id:id, html:main_html, isfront:drupalSettings.path.isFront}})
|
|
|
}).$mount('#'+id)
|
|
|
-
|
|
|
}
|
|
|
|
|
|
function initVSearchBlock(){
|