Vue.js and vue-moment: “Failed to resolve filter: moment”

后端 未结 4 1298
时光说笑
时光说笑 2021-02-10 09:06

Trying to use vue-moment. The simplest possible example from the documentation doesn\'t work: https://jsfiddle.net/rjcpz9wt/

{{ new Date() | moment \         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-02-10 09:38

    My answer may be too late but still useful for others who are facing this problem right now. As @Gerardo Grignoli said, vue-moment is broken so personally I used

    import moment from "moment"
    Vue.prototype.$moment = moment; 
    // later in component 
    computed: {
        theDate(){ 
            return this.$moment('2019-10-30T11:10:21.484894Z').format('DD.MM.YYYY'); 
        }
    }
    

提交回复
热议问题