32 lines
1.4 KiB
JavaScript
32 lines
1.4 KiB
JavaScript
![]() |
import { __assign } from "tslib";
|
||
|
import equal from 'fast-deep-equal';
|
||
|
import { Component, getValueFromProps, triggerEventOnly } from '../_util/simply';
|
||
|
import { PageDefaultProps, BuiltinStatus } from './props';
|
||
|
Component(PageDefaultProps, {
|
||
|
handleActionTap: function (e) {
|
||
|
triggerEventOnly(this, 'actionTap', e);
|
||
|
},
|
||
|
handleSecondaryActionTap: function (e) {
|
||
|
triggerEventOnly(this, 'secondaryActionTap', e);
|
||
|
},
|
||
|
updatePageStatus: function (prevProps, nextProps) {
|
||
|
var _a, _b, _c;
|
||
|
if (!equal(prevProps, nextProps)) {
|
||
|
var status_1 = nextProps.status, image = nextProps.image, title = nextProps.title, message = nextProps.message;
|
||
|
var updateData = __assign(__assign({}, nextProps), {
|
||
|
// 自定义内容优先 status
|
||
|
image: image || ((_a = BuiltinStatus[status_1]) === null || _a === void 0 ? void 0 : _a.image) || '', title: title || ((_b = BuiltinStatus[status_1]) === null || _b === void 0 ? void 0 : _b.title) || '', message: message || ((_c = BuiltinStatus[status_1]) === null || _c === void 0 ? void 0 : _c.message) || '' });
|
||
|
this.setData(updateData);
|
||
|
}
|
||
|
}
|
||
|
}, {}, undefined, {
|
||
|
didMount: function () {
|
||
|
var props = getValueFromProps(this);
|
||
|
this.updatePageStatus({}, props);
|
||
|
},
|
||
|
deriveDataFromProps: function (nextProps) {
|
||
|
var props = getValueFromProps(this);
|
||
|
this.updatePageStatus(props, nextProps);
|
||
|
}
|
||
|
});
|