How to call the method method in filter in vue component

how does the following filters call padDate in method and pass a value?
filters: {

    formatDate: function(value) {
        let _this = this;
        let date = new Date(value);
        let year = date.getFullYear();
        let month = padDate(date.getMonth()+1);
        let day = padDate(date.getDate());
        let hour = padDate(date.getHours());
        let minutes = padDate(date.getMinutes());
        let seconds = padDate(date.getSeconds());
        return year +"-"+month +"-"+day+""+hour+":"+minutes+":"+seconds;
    }

},
methods: {

  padDate(value){
      return value <10?"0"+value :value;
  }

}

Apr.09,2021

this.padDate (xx) access


what to do at last


when writing functions, use formatDate: (vaule) = > {/ * code*/} to pass this, and then use this.padDate (v) should be feasible


filters this is window, The context is not vue


var _ this = window.vm


{{ this | filterMsg}
passes this into filter as a parameter, so you can access the methods defined in methods.


is written directly in methods, how about calling it directly in the view?

methods: {
    formatDate(value){
        padDate(value)
    }
<view>{{formate(date)}}</view>
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-1b30953-2bd3e.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-1b30953-2bd3e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?