jeawin-astro 4.0.13 → 4.0.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jeawin-astro",
3
- "version": "4.0.13",
3
+ "version": "4.0.14",
4
4
  "author": "chaegumi <chaegumi@qq.com>",
5
5
  "description": "Astro components for Jeawin CMS",
6
6
  "license": "MIT",
@@ -98,11 +98,15 @@ export function render_date(locale = 'en', t, f = 'MMM DD, YYYY') {
98
98
  * 安全输出数据
99
99
  */
100
100
  export function render_value(obj, prop, def = '') {
101
- const propValue = _.get(obj, prop, def);
102
- if (_.isString(propValue)) {
103
- return _.replace(propValue, '{{YEAR}}', dayjs().format('YYYY'));
101
+ const propValue = _.get(obj, prop);
102
+ let returnValue = propValue;
103
+ if (returnValue === null || returnValue === undefined || returnValue === '') {
104
+ returnValue = def;
104
105
  }
105
- return propValue;
106
+ if (_.isString(returnValue)) {
107
+ return _.replace(returnValue, '{{YEAR}}', dayjs().format('YYYY'));
108
+ }
109
+ return returnValue;
106
110
  }
107
111
 
108
112
  /**