Ruby Ruby - 2 months ago 22
Javascript Question

whats wrong with my code vue js and moment js

My code doesn't work:https://jsfiddle.net/rjcpz9wt/

[Vue warn]: Failed to resolve filter: moment


thankss

Answer

I wouldn't suggest doing it the way you are, you should create the date variable in the javascript code and just access the variable in your Vue. Here is a fiddle showing what I mean

https://jsfiddle.net/rdffywc7/

var app = new Vue({
  el: document.body,
  data: {
    date: moment().format("dddd, MMMM Do YYYY")
  }
})

and then in the doc body

<span>{{ date }}</span>
Comments