无法直接调用 this
    beforeCreate 生命周期 将 this ,赋值给 that,通过 that 调用 this

    1. var vm = new Vue({
    2. el: '#app',
    3. data: {
    4. },
    5. beforeCreate: function () {
    6. that = this
    7. },
    8. methods:{
    9. fom(fmt){
    10. ...
    11. }
    12. },
    13. ....,
    14. filters: {
    15. dateformate: function (val) {
    16. return that.fom("yyyy-MM-dd")
    17. }
    18. }
    19. })