new Date().format("YYYY-mm-dd")
javascript调用上述代码报错,(intermediate value).Format is not a function。

意思是说Format不是一个方法。

ES6已经去掉此方法了,要使用的话,需要添加第三方库。

 解决方法

去github上下载依赖,并添加到项目中去,然后使用<script>标签进行引用

https://github.com/jacwright/date.format

相关文章:

  • 2021-09-24
  • 2021-05-15
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2021-11-18
  • 2021-08-31
相关资源
相似解决方案