Vue uses id jump details page to report an error

list page
<template>
    <div class="ind">
        <dl v-for="list in tabLists">
            <dt><img :src="list.img" alt=""></dt>
            <dd><b>{{list.nm}}</b></dd>
            <button @click="pushDetail(list.id)"></button>
        </dl>
    </div>
</template>
<script>
    import axios from "axios"
    export default {
        name: "app",
        data() {
            return {
                tabLists: []
            }
        },
        mounted() {
            this.getJson();
        },
        methods: {
            getJson() {
                const url = "http://localhost:8080/api"
                axios.get(url).then(res => {
                    console.log(res);
                    this.tabLists = res.data.movieList;
                });
            },
            //
            pushDetail: function(id) {
                this.$router.push({
                    name: "Detail",
                    params: {
                        id
                    }
                })
            }
        },


    }
</script>
<style>
    * {
        margin: 0;
        padding: 0;
    }

    ul,
    li,
    ol {
        list-style: none;
    }

    .ind {
        width: 100%;
    }

    .ind dl {
        display: flex;
    }

    .ind dl dd {
        flex: 1;
    }

    .ind dl dt {
        flex: 1;
    }

    button {
        width: 50px;
        height: 40px;
    }
</style>
< hr >
details page
<template>
    <div class="detail">
        <dl v-for="(list,index) in detailData" :key="index">
            <dt>
                <img :src="list.avatar">
            </dt>
            <dd>
                <h2>{{list.title}}</h2>
            </dd>
        </dl>
    </div>
</template>

<script>
import axios from "axios";
export default {
    name:"detail",
    data(){
        return {
            id : 0,
            allData : [],
            detailData: []
        }
    },
    mounted() {

        this.id=this.$route.params.id;
        axios.get("http://localhost:8080/static/data.json").then( res => {
            this.allData = res.data.data; 
            this.detailData = this.allData.filter((v,i) => {
                return v.id == this.id;
            })
        })
    },
}
</script>

<style>
    .detail{
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }

    .detail h2{
        padding-top: 10px;
    }
</style>

browser error

Nov.27,2021

isn't the prompt obvious? verify that the return value of the next details page is correct

.
axios.get('http://localhost:8080/static/data.json').then(res => {
  console.log(res.data); //res.data.data
/*  this.allData = res.data.data;
  this.detailData = this.allData.filter((v, i) => {
    return v.id == this.id;
  });*/
});

res.data.data is an object. The object has no filter method. You can try

.
this.allData.push(res.data.data);

/ / then do the following:

 this.detailData = this.allData.filter((v, i) => {
    return v.id == this.id;
  });
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb3fcf-249d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb3fcf-249d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?