[Vuejs]-Generate unique ID for Vue component via mixin

0👍

Moved out the uuid declaration so it’s sure it’s never reevaluated.

import Vue from 'vue'
import { nanoid } from 'nanoid'

const uuid = nanoid()

export default Vue.extend({
  name: 'Identifiable',

  data: () => ({
    uuid
  }),
})

Leave a comment