wotamann / vuetify-form-base

Schema-based Form Generator - Vue.js 2.0 Component based on Vuetify 2.0
https://wotamann.github.io/vuetify
230 stars 63 forks source link

How does one bind the "items" to an attribute #62

Closed Mashiane closed 4 years ago

Mashiane commented 4 years ago

Hi there

Instead of specifiying items for selects etc like items = ['A', 'B', 'C']

How do I achieve the same by assigning such to the state like :items="itemSource", where itemSource is stored on the Vue instance?

Thank you.

wotamann commented 4 years ago

use computed schema

data () {
    return {
      items: ['A', 'B'],
      myModel: {
        selection: 'A',
      },

    }
  },
  computed: {
    mySchema() {
      return {
        selection: { type: 'select', items:this.items },
      }
    }
  },
Mashiane commented 4 years ago

Thank you.