Vue.js 报错 [Vue warn]: Computed property "getSearchOther" was assigned to but it has no setter. 作者: Chuwen 时间: 2021-06-15 分类: Vue.js 评论 ```log [Vue warn]: Computed property "getSearchOther" was assigned to but it has no setter. ``` 我是这么写的: ```js //这里省略部分代码 watch:{ getSearchOther() { return this.SearchOther }, } //这里省略部分代码 ``` ## 解决方案 手动给予 `get`、`set` 方法 参照官方文档:[https://cn.vuejs.org/v2/guide/computed.html#计算属性的 setter](https://cn.vuejs.org/v2/guide/computed.html#%E8%AE%A1%E7%AE%97%E5%B1%9E%E6%80%A7%E7%9A%84-setter "https://cn.vuejs.org/v2/guide/computed.html#计算属性的 setter") ```js //这里省略部分代码 watch:{ getSearchOther: { get() { return this.SearchOther }, set(newVal) { this.SearchOther = newVal; } }, } //这里省略部分代码 ```
整了个小玩意-佳寓用电明细查询 作者: Chuwen 时间: 2021-06-14 分类: PHP 评论 > 虽然是个小东西,但为了做的完美些,也肝了2天空闲时间 项目地址:https://github.com/PrintNow/jiayu-hydropower-query 在线预览:https://nowtime.cc/jiayu/ 
PHPStorm 快速预览定义的 方法/函数 代码 作者: Chuwen 时间: 2021-06-11 分类: 其他分类 评论 ### mac 下的快捷键是 `Alt + 空格` 
使用 Dayjs 校验日期是否符合指定的日期格式 作者: Chuwen 时间: 2021-06-10 分类: JavaScript 评论 > 参阅文档:https://day.js.org/docs/zh-CN/display/format#docsNav > > 使用本功能需先配置 [LocalizedFormat][1] 插件,才能正常运行 ```js /** * * 检查日期是否为 指定的日期格式 * @param {String} format * @param {String} datetime * @returns {boolean} */ checkDatetimeFormat(format, datetime) { const dayjs = require('dayjs') return dayjs(datetime).format(format) === datetime } ``` [1]: https://day.js.org/docs/zh-CN/plugin/localized-format "localizedFormat"
PHP 检查日期是否符合某一种“日期格式” 作者: Chuwen 时间: 2021-06-10 分类: PHP 评论 代码如下: > 关于日期格式,请参阅:https://www.php.net/manual/zh/datetime.format.php ```php /** * 检查某个日期是否符合 $format 格式 * * @param string $format 日期匹配规则 * @param mixed $datetime 日期 * * @return bool 匹配结果,如果符合返回 true 反之亦反是 * * @author: Chuwen * @date : 2021/6/10 14:30 */ function checkDatetimeFormat(string $format = 'M d, Y', $datetime): bool { return DateTime::createFromFormat($format, $datetime) !== false; } ```