2021年7月

    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=""/>

django-admin startproject [project_name] //新建项目
django-admin startapp [app_name] //新建应用
python manage.py runserver //开启后端服务
python manage.py createsuperuser //创建超级用户
python manage.py makemigrations //制作迁移数据
python manage.py migrate //开始迁移
python manage.py shell //命令模式

通过关键字(var)声明的变量,其实在浏览器使用的过程中生命的变量是属于window对象的。
而通过关键字(let)声明的变量,则是一个根据在代码块中的位置决定其是属于某个局部块位置的变量。
window_a.png