var vue_fn = { filters:{ formatDate: function (value) { if(value==null){ return ""; } let date = new Date(value); let year = date.getFullYear(); let month = date.getMonth()+1; let day = date.getDate(); month = month < 10 ? "0"+month:month; day = day < 10 ? "0"+day:day; date = year+'-'+month+'-'+day; return date; }, formatDateTime: function (value) { if(value==null){ return ""; } let date = new Date(value); let year = date.getFullYear(); let month = date.getMonth()+1; let day = date.getDate(); let h = date.getHours(); let mm = date.getMinutes(); let s = date.getSeconds(); month = month < 10 ? "0"+month:month; day = day < 10 ? "0"+day:day; date = year+'-'+month+'-'+day+" "+h+":"+mm+":"+s; return date; } }, methods: { showPhoto: function (title, url) {//显示图片 var json = { "data": [{ "alt": title, "src": url, }] } layer.photos({ photos: json //格式见API文档手册页 // ,anim: 1 //0-6的选择,指定弹出图片动画类型,默认随机 }); } } }
子vue
var childvue1 = new Vue({ extends : vue_fn, el: '#settleDetailDev', data: { } , mounted: function () { }, methods: {} })