分类 javascript 下的文章

    new Vue({
        delimiters: ['[[', ']]'],
        el: '#home',
        data: {
            inputText: '',
            film_genres: [],
            chose: 3,
            onOff: false,
        },
        mounted() {
            this.getData()
        },
        methods: {
            getData() {
                axios({
                    url: '/api/',
                    type: 'json',
                    method: 'get',
                }).then((res) => {
                    console.log(res.data.film_genres)
                    this.film_genres = res.data.film_genres
                })
            },
            chooseMenu(id) {
                console.log(id)
                this.chose = id
            },
            switchOnOff() {
                this.onOff = !this.onOff
            }

        },
    })
    <input v-model="inputText" type="text" name="" id="" style="height: 30px;width: auto;">
    <div v-if="genres.id === chose" v-for="genres in film_genres" class="item"        
    <button v-on:click="switchOnOff">On/Off</button>
    <div v-if="onOff">
    <img :src="'upload/'+[[film_info.film_icon]]" alt=""/>