[Vuejs]-How to make dropdown list with Vue 3?

0👍

Anyway, I managed successfully to do following without VueSelect:

var productForm = Vue.createApp ({})

        productForm.component('custom-form', {
                template: `
                <label>SKU<input type="text" v-model="this.product.sku"></label>
                <label>Name<input type="text" v-model="this.product.name"></label>
                <label>Price<input type="text" v-model="this.product.price"></label>
                <label>Attributes<select v-model="selected">
                    <option 
                        v-for="item in options" 
                        >{{item}}
                    </option>
                </select></label>
                ` ,
            
            data: function() {
                return {
                    product: {
                        sku: 0,
                        name: 'asdf',
                        price: 0
                    },
                    options: ['Size', 'Weight', 'Dimensions'],
                    selected: 'Size'
                }
            }
        })
       
        productForm.mount('#product_form')

Leave a comment