[Vuejs]-How to get name of object send in function vue

0๐Ÿ‘

can you make a demo in codepen or something like that?

let importedComponent= (keyname)=> ({
  async mounted() {
    if(keyname in this)
      this[keyname] = await this.$content.get({[keyname]: this[keyname])
    else throw()
  }
})

export default {
  mixin: [
    importedComponent("portfolio")
  ],
  data() {
    return {
      portfolio: {
        portfolioID: null
      } 
    }
  },

}

Leave a comment