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 +1 -1
- package/src/scripts/util.js +8 -4
package/package.json
CHANGED
package/src/scripts/util.js
CHANGED
|
@@ -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
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
const propValue = _.get(obj, prop);
|
|
102
|
+
let returnValue = propValue;
|
|
103
|
+
if (returnValue === null || returnValue === undefined || returnValue === '') {
|
|
104
|
+
returnValue = def;
|
|
104
105
|
}
|
|
105
|
-
|
|
106
|
+
if (_.isString(returnValue)) {
|
|
107
|
+
return _.replace(returnValue, '{{YEAR}}', dayjs().format('YYYY'));
|
|
108
|
+
}
|
|
109
|
+
return returnValue;
|
|
106
110
|
}
|
|
107
111
|
|
|
108
112
|
/**
|