Dear Support,
I use this menu on my website : https://ej2.syncfusion.com/vue/demos/samples/sidebar/sidebar-menu/index.html
However, I have a problem : When I click on a link of the menu, it reloads all the page, instead of reloading only the content part.
My links are defined in each "url" attribute of the menuItems.
I juste want the "content" part to be reloaded, not the entire page, like the menu on your on website : https://ej2.syncfusion.com/home/index.html#platform
=> When you click on "javascript", "angular" (etc), it reloads only the content. This is exactly what I would like.
Can you help me ?
My code is in the AppLayout.txt file.
Thank you in advance.
|
<template>
<div class="template-menu-control">
<ejs-menu :items="data" :fields="menuFields" :template="menuTemplate"></ejs-menu>
<div id="app">
<router-view></router-view>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { MenuPlugin } from "@syncfusion/ej2-vue-navigations";
Vue.use(MenuPlugin);
export default {
data: function() {
var menutemplateVue = Vue.component("demo", {
template: ' <span v-if="data.category"> {{data.category}} </span>'+
' <div v-else-if="data.value" style="width: 100%;display: flex;justify-content: space-between;">'+
'<router-link :to="data.url" exact tag="li"><a class="e-menu-url">{{data.value}}</a></router-link></div>' +
'<span class="e-menu-template" v-else-if="data.support">'+
'<ul>'+
'<li v-bind:key="index" v-for="(val,index) of data.support">'+
' {{val.value}} ' +
'<span v-if="val.count" class="e-badge e-badge-success">{{val.count}}</span> '+
' </li> '+
'</ul>'+
'</span>',
data() {
return {
data: {}
}
}
});
return {
data: [
{
category: 'Products',
options: [
{ value: 'JavaScript', url: 'javascript' },
{ value: 'Angular', url: 'angular' },
{ value: 'ASP.NET Core', url: 'core' },
{ value: 'ASP.NET MVC', url: 'mvc' }
]
},
{
category: 'Services',
options: [
{
support: [
{ value: 'Application Development', count: '1200+' }, ]
}
]
},
{ category: 'Careers' },
{ category: 'Sign In' }
],
menuFields: {
text: ['category', 'value'],
children: ['options']
},
menuTemplate: function () {
return {
template : menutemplateVue
}
}
};
}
} |
Thank you for your reply.
I am sorry but I don't understand your sample zip file at all, because it is very different from your sample just above.
For instance, in the App.vue file you have
"id="querybuilder" ref="querybuilder"
1 /==> What is ejs-query-builder ? What is it used for and why is it needed for this menu ?
I am pretty lost, because the code in your sample zip file does not look like the initial demo code at all, and there is no querybuilder in it : https://ej2.syncfusion.com/vue/demos/#/material/sidebar/sidebar-menu.html
So what is the good code ? What should I use ? The example above of your sample.zip file ?
Moreover, I don't understand this part in your example above :
WARNING in ./node_modules/@syncfusion/ej2-vue-querybuilder/node_modules/vue-class-component/dist/vue-class-component.esm-bundler.js 387:27-30
export 'ref' (imported as 'ref') was not found in 'vue' (possible exports: default)
WARNING in ./node_modules/@syncfusion/ej2-vue-querybuilder/node_modules/vue-class-component/dist/vue-class-component.esm-bundler.js 402:35-44
export 'proxyRefs' (imported as 'proxyRefs') was not found in 'vue' (possible exports: default)
WARNING in ./node_modules/@syncfusion/ej2-vue-querybuilder/node_modules/vue-class-component/dist/vue-class-component.esm-bundler.js 407:31-40
export 'proxyRefs' (imported as 'proxyRefs') was not found in 'vue' (possible exports: default)
==> Can you please explain me what is it about, and how can I remove theses warnings ?
Anyway it doesn't work I have many errors and no menu on my page :(
PICTURE LINK
4/ Instead of the sample.zip file, can you please share a complete online sample , with everything needed included (ejs-menu, router-view and so on)? This is really easier to check if the code works well.
I mean an online sample like this one for stance : https://codesandbox.io/s/form-validation-forked-2263r?file=/src/App.vue
Best regards :)
PS : I joined my AppLayout code where I tried to make it as your sample above.
However I guess I have some problems with the data [category ] part and the menuTemplate part because id dos not work I can't see the menu
Best regards :)
|
import Vue from 'vue'
import App from './App.vue'
import Router from "vue-router";
import router from './router'
Vue.use(Router);
new Vue({
router,
el: '#app',
render: h => h(App),
})
|
|
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from './Home'
import Core from './Core'
import Mvc from './Mvc'
import Javascript from './Javascript'
import Angular from './Angular'
Vue.use(VueRouter)
const routes = [
{ path: '/', component: Home },
{ path: '/core', component: Core },
{ path: '/angular', component: Angular},
{ path: '/mvc', component: Mvc},
{ path: '/javascript', component: Javascript}
]
export default new VueRouter({
routes,
mode: 'history',
})
|
|
<template>
<div class="template-menu-control">
<ejs-menu :items="data" :fields="menuFields" :template="menuTemplate"></ejs-menu>
<div id="app">
<router-view></router-view>
</div>
</div>
</template>
<script>
import Vue from "vue";
import { MenuPlugin } from "@syncfusion/ej2-vue-navigations";
Vue.use(MenuPlugin);
export default {
data: function() {
var menutemplateVue = Vue.component("demo", {
template: ' <span v-if="data.category"> {{data.category}} </span>'+
' <div v-else-if="data.value" style="width: 100%;display: flex;justify-content: space-between;">'+
'<router-link :to="data.url" exact tag="li"><a class="e-menu-url">{{data.value}}</a></router-link></div>' +
'<span class="e-menu-template" v-else-if="data.support">'+
'<ul>'+
'<li v-bind:key="index" v-for="(val,index) of data.support">'+
' {{val.value}} ' +
'<span v-if="val.count" class="e-badge e-badge-success">{{val.count}}</span> '+
' </li> '+
'</ul>'+
'</span>',
data() {
return {
data: {}
}
}
});
return {
data: [
{
category: 'Products',
options: [
{ value: 'JavaScript', url: 'javascript' },
{ value: 'Angular', url: 'angular' },
{ value: 'ASP.NET Core', url: 'core' },
{ value: 'ASP.NET MVC', url: 'mvc' }
]
},
{
category: 'Services',
options: [
{
support: [
{ value: 'Application Development', count: '1200+' },
{ value: 'Maintenance & Support', count: '3700+' },
{ value: 'Quality Assurance' },
{ value: 'Cloud Integration', count: '900+' }
]
}
]
},
{ category: 'Careers' },
{ category: 'Sign In' }
],
menuFields: {
text: ['category', 'value'],
children: ['options']
},
menuTemplate: function () {
return {
template : menutemplateVue
}
}
};
}
}
</script>
|
|
|
|
|
|
|