Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
how should javascript array control be

there is an array data as below. I will have a nav. operation on the incoming data data in the array, otherwise I will print the data it is, I wonder how can I do this?`

title: item.title,

if item.title in the incoming data nav. If there is Let this.$t(item.title) pass the print check. but if there is no nav. then check if this.$t(item.title)

menu_items: [
        {
          title: 'nav.home',
          path: '/',
          Index: 0
        },
        {
          title: 'nav.gallery',
          path: '/gallery',
          order: 10
        },
        {
          title: 'nav.contact',
          path: '/contact',
          order: 12
        },
        {
          title: 'hello',
          path: '/hello',
          order: 13
        },
        {
          title: 'hello2',
          path: '/hello2',
          order: 14
        }
      ]
menuItem() {
      return this.menu_items.map(item => {
        return {
          title: item.title,
          path: item.path,
          children: item.children,
          order: item.order
        }
      }).sort((a, b) => a.order - b.order)
    }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

first thing you need to do is search item.title item.title.search('nav.') If there is no nav. in the data after checking, if item.title exists, this.$t(item.title)

menuItem() {
      return this.menu_items.map(item => {
        return {
          title: item.title.search('nav.') ? item.title : this.$t(item.title),
          path: item.path,
          children: item.children,
          order: item.order
        }
      }).sort((a, b) => a.order - b.order)
    }
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!