in Education by
I asked a question yesterday and none of the answers are working so I decided to start a fresh one with more details. You can view the question here: VueJS - using mustache template strings inside href attribute Basically I have a vue app split out into components. That project structure looks like below: Inside my "Nav.vue" component, I have a navigation that I want to loop through inside a data block. The entire code of the component looks like this:
export default { name: 'Nav', data: function() { return { menuItems: [ {text: 'Item 1', url: '/item-1'}, {text: 'Item 2', url: '/item-2'}, {text: 'Item 3', url: '/item-3'}, {text: 'Item 4', url: '/item-4'} ] } } } In the answers of the previous question I have done everything suggested: making data a function using proper syntax for link {{ menuItems.text }} fixing the typo in menu items. However, my
    is totally empty after all those suggestions. Why? My App.vue looks like this: main.js looks like this: import Vue from 'vue' import App from './App.vue' import router from './router' import store from './store' Vue.config.productionTip = false new Vue({ router, store, render: h => h(App) }).$mount('#app') router.js looks like this: import Vue from 'vue' import Router from 'vue-router' import Home from './views/Home.vue' Vue.use(Router) export default new Router({ mode: 'history', base: process.env.BASE_URL, routes: [ { path: '/', name: 'home', component: Home }, { path: '/about', name: 'about', // route level code-splitting // this generates a separate chunk (about.[hash].js) for this route // which is lazy-loaded when the route is visited. component: () => import(/* webpackChunkName: "about" */ './views/About.vue') } ] }) With all that shared - do I need to put my data somewhere else? Why is my empty? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
In this part of the code: You have to change menuItems.text to menuItem.text.

Related questions

0 votes
    I have a custom input validation component that I use in a form. Something like 15 instances of this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 17, 2022 in Education by JackTerrance
0 votes
    I am looking for a way to close a component when there it a click outisde of the element. I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 19, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: When to use ":"(colon) operator in javascript vs "=" operator ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 3, 2022 in Education by JackTerrance
0 votes
    This question already has answers here: When to use ":"(colon) operator in javascript vs "=" operator ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 2, 2022 in Education by JackTerrance
0 votes
    How can looping be done over a list of hosts in a group, inside of a template?...
asked Jul 29, 2021 in Technology by JackTerrance
0 votes
    I have this array of objects. let links = [ { url: 'some url 1', status: 200 }, { url: ... questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 16, 2022 in Education by JackTerrance
0 votes
    I am trying to return an javascript value with Awesome lib in Vb.net / C#. Now I know how to ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    ____ allows you to loop through a block of code as long as the specified condition is true. 1. Tag 2. While 3. For...
asked Feb 24, 2021 by JackTerrance
0 votes
    I have function of "endgame" and here's how the function goes function endgame() { setScreen("scorescreen" ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 6, 2022 in Education by JackTerrance
0 votes
    I have set up Vue so that I have a top level AppLayout component which just includes a Navigation Menu ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I need help on looping all my list and print my list name. Currently, I have a few raspberry pi types and windows PC ... ) print ("\n") Select the correct answer from above options...
asked Jan 8, 2022 in Education by JackTerrance
0 votes
    Different JavaScript Questions and Answers...
asked Sep 17, 2022 in Technology by Editorial Staff
0 votes
    I've created a getSpectrum method using the getByteFrequencyData method on the Web Audio API's Analyser Node ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 27, 2022 in Education by JackTerrance
0 votes
    This is part of the component : import MyComp from '../../lib/MyComp' const Data = ( { data } ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 26, 2022 in Education by JackTerrance
0 votes
    Have jquery dialog as closeOnescape as false. want to trigger an event based on esc key press how do ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 20, 2022 in Education by JackTerrance
...