samedi 28 septembre 2019

Hiding template and how if option selected

Can I ask some help I have select option and I want to show the form base on selected option but I cannot to get it working here is my code.

    <template>

        <div class="column is-12">
            <div class="box">
                <div class="field">
                    <label class="label">Category:  </label>
                    <div class="control">
                        <div class="select">
                            <select v-model="selectedValue">
                                <option v-for="category in categories.data"  :value="category.id" ></option>
                            </select>
                        </div>
                    </div>
                </div>


                <myform1-form v-show="selectedValue === 1"></myform1-form>
                <myform2-form v-show="selectedValue === 2"></myform2-form>

            </div>
        </div>


</template>

<script>
    export default {
        data(){
            return{
                categories: [],
                selectedValue: null,
                showForm: false
            }
        },
        mounted(){

            axios.get('api/category_api').then(response=> this.categories = response.data);
        }
    }
</script>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire