Step 1. Create a folder, and name it to service

Step 2. Create externalLinksService.js

export default class sss {
  get () {
    return [
      { href: 'https://vuejs.org', target: '_blank', content: 'Core Docs' },
      { href: 'https://forum.vuejs.org', target: '_blank', content: 'Forum' },
      {
        href: 'https://chat.vuejs.org',
        target: '_blank',
        content: 'Community Chat'
      },
      {
        href: 'https://twitter.com/vuejs',
        target: '_blank',
        content: 'Twitter'
      },
      {
        href: 'http://vuejs-templates.github.io/webpack/',
        target: '_blank',
        content: 'Docs for This Template'
      },
      {
        href: 'http://router.vuejs.org/',
        target: '_blank',
        content: 'vue-router'
      },
      { href: 'http://vuex.vuejs.org/', target: '_blank', content: 'vuex' },
      {
        href: 'http://vue-loader.vuejs.org',
        target: '_blank',
        content: 'vue-loader'
      },
      {
        href: 'https://github.com/vuejs/awesome-vue',
        target: '_blank',
        content: 'awesome-vue'
      }
    ]
  }
}

Step 3. Component call this service

import ExternalLinksService from '../services/externalLinksService'
const es = new ExternalLinksService()

console.log('externalLinksb', es.get())

export default {
  name: 'HelloWorld',
  data: function () {
    return {
      msg: 'Welcome to Your Vue.js App 11111111111',
      externalLinks: es.get()
    }
  },

results matching ""

    No results matching ""