Vue.js 使用slice的Vue js表
我的日期格式:2018-12-29 00:00:00。我可以使用.slice(0,10)作为我的表日期字段吗Vue.js 使用slice的Vue js表,vue.js,Vue.js,我的日期格式:2018-12-29 00:00:00。我可以使用.slice(0,10)作为我的表日期字段吗 <template> <table striped hover :items="Food" :fields="food_fields"> </table> </template> data() { return { Food: [......//data],
<template>
<table striped hover :items="Food" :fields="food_fields">
</table>
</template>
data() {
return {
Food: [......//data],
food_fields: [
{
key: 'name', label: 'Name'
},
{
key: 'date', label: 'Date'
}
],
}
},
数据(){
返回{
食品:[……//数据],
食品和食品领域:[
{
键:“名称”,标签:“名称”
},
{
键:“日期”,标签:“日期”
}
],
}
},
现在我的表格显示:
食用日期
苹果2018-12-29 00:00:00(我想要2018-12-29)
Orange 2018-12-30 00:00:00使用简单的js日期函数或任意时刻的js函数进行转换
(new Date()).toISOString().split('T')[0]
改用moment.js 我们有同样的问题,我用moment.js来解决。 看看这个