Take all the data from the array according to a certain field

    data() {
        return {
            datalist:[
            {
               "title":"1"
               "time":"2018-06-24"
            },
            {
                "title":"2"
                "time":"2018-06-24"
            },
            {
                "title":"3"
                "time":"2018-06-29"
            }],
        }
    },
         clickDay(data) {
            var a = data.split("/");
            var curData = a[0] + "-" + (a[1] < 10 ? "0":"") + a[1]+"-"+ (a[2] < 10 ? "0":"")+a[2];
            //console.log(curData);
        },

each click, the value of curData is different, then compare the time value in datalist, if the same, render the current data, click which to render which data

Mar.22,2021

datalist.filter(item=>item.time === '2018-06-24')
< hr >

this is how vue is written. Datalist is the total data requested, and searchTime is the time of Filter. (make sure that the time format in the requested data is the same as), filterData, and then listen to searchTime and datalist, to change the value of filterData

.
computed:{
    filterData:function(){
        this.datalist.filter(item => this.searchTime == '' ? item.time === this.searchTime : true)
    }
},

datalist.find(v=>v.time===yourTime)

do you mean that Filter returns array data according to a condition?
you can consider the Filter condition processing of the array.


let datalist = [
    {
       'title':'1',
       'time':'2018-06-24'
    },
    {
        'title':'2',
        'time':'2018-06-24'
    },
    {
        'title':'3',
        'time':'2018-06-29'
    }]
datalist = datalist.filter(d => d.time === '2018-06-24')
console.log(datalist)

filter

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-1b30366-2bd11.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-1b30366-2bd11.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?