Give me a time stamp at the back end. How can I change the format? can the framework of ele.me write method binding?

the backend gives me a timestamp, and I define an array that is directly equal to the data returned by the backend, but isn"t the component of table ele.me directly equal to the data given to me by the backend? for example, if I want to judge or change the timestamp format, how should I write it?

ele.me component
clipboard.png

clipboard.png


clipboard.png


you can use the computed attribute to change the time

//
    function formatDateTime(timeStamp) {
        var date = new Date();
        date.setTime(timeStamp * 1000); //*1,*1000
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m < 10 ? ('0' + m) : m;
        var d = date.getDate();
        d = d < 10 ? ('0' + d) : d;
        var h = date.getHours();
        h = h < 10 ? ('0' + h) : h;
        var minute = date.getMinutes();
        var second = date.getSeconds();
        minute = minute < 10 ? ('0' + minute) : minute;
        second = second < 10 ? ('0' + second) : second;
        return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
    };

the data is processed directly when it is obtained, and the processed data is used by the component;


vue has a filter.

ide/filters.html" rel=" nofollow noreferrer "> https://cn.vuejs.org/v2/guide.

I am also a rookie. This is a description on the official website.

Menu