修改了userRelation中的listeners属性

This commit is contained in:
Xu Chang 2023-02-21 17:30:15 +08:00
parent 75a7651331
commit 2c9bc28130
2 changed files with 18 additions and 22 deletions

View File

@ -138,20 +138,19 @@ exports.default = OakComponent({
],
idRemoveMp: '',
},
observers: {
'entity,entityId': function (entity, entityId) {
if (this.state.oakFullpath && entity && entityId) {
this.refresh();
listeners: {
'entity,entityId': function (prev, next) {
if (this.state.oakFullpath) {
if (prev.entity !== next.entity || prev.entityId !== next.entityId) {
this.refresh();
}
}
},
relations: function (value) {
var relations = this.props.relations;
if (this.state.oakFullpath &&
(value.length !== relations.length ||
(0, lodash_1.difference)(value, relations).length > 0)) {
relations: function (prev, next) {
if (this.state.oakFullpath && ((0, lodash_1.difference)(prev.relations, next.relations).length > 0)) {
this.refresh();
}
},
}
},
lifetimes: {
ready: function () {

View File

@ -135,22 +135,19 @@ export default OakComponent({
],
idRemoveMp: '',
},
observers: {
'entity,entityId': function (entity, entityId) {
if (this.state.oakFullpath && entity && entityId) {
this.refresh();
listeners: {
'entity,entityId'(prev, next) {
if (this.state.oakFullpath) {
if (prev.entity !== next.entity || prev.entityId !== next.entityId) {
this.refresh();
}
}
},
relations: function (value) {
const { relations } = this.props;
if (
this.state.oakFullpath &&
(value.length !== relations.length ||
difference(value, relations).length > 0)
) {
relations(prev, next) {
if (this.state.oakFullpath && (prev.relations.length !== next.relations.length || difference(prev.relations, next.relations).length > 0)) {
this.refresh();
}
},
}
},
lifetimes: {
ready() {