优化Vue代码:使用对象字典简化时间格式判断
"使用对象字典来优化代码,减少重复的代码。\n\n\nconst timerFormat = {\n day: \"YYYY-MM-DD\",\n month: \"YYYY-MM\",\n year: \"YYYY\"\n}\n\nthis.timerValue = this.$moment(val).format(timerFormat[this.timerType])\n\n
原文地址: https://www.cveoy.top/t/topic/pL0p 著作权归作者所有。请勿转载和采集!