Files
fc/dev/project/library/imports/73/736a98fb-e803-4861-9be6-fa194df5a0f2.js
2026-05-24 10:21:26 +08:00

69 lines
1.7 KiB
JavaScript

"use strict";
cc._RF.push(module, '736a9j76ANIYZvm+hlN9aDy', 'nx.fx.sv.expand.item');
// Scripts/nx/cmp/flex/nx.fx.sv.expand.item.js
"use strict";
/******************************************************************
* Copyright(C) 2019 - 2020 Nx Studio
*
* NX UI插件 -- 动态扩充列表表项
*
* 2018.05.18
******************************************************************/
cc.Class({
"extends": cc.Component,
properties: {
flexHeight: {
"default": false
}
},
// 数据重置
rebind: function rebind(_idx, _data, _key) {
this.index = _idx;
this.mdata = _data;
this.key = _key || "";
this.openFlexHeight(this.flexHeight);
},
// 开关点击支持
openTouch: function openTouch(_open, _cb) {
this.touchOpened = _open;
this.touchCB = _cb;
if (_open) {
this.node.on("touchend", this.onTouch, this);
} else {
this.node.off("touchend", this.onTouch, this);
}
},
// 激活( 不可见->可见 )
inShow: function inShow() {},
// 反激活( 可见->不可见 )
outShow: function outShow() {},
// 聚焦获得
onFocus: function onFocus() {},
// 聚焦失去
outFocus: function outFocus() {},
// 开启不定高模式
openFlexHeight: function openFlexHeight(_open) {
this.node.off("size-changed", this.onSizeChanged, this);
if (_open) {
this.node.on("size-changed", this.onSizeChanged, this);
}
},
// 自身尺寸改变了
onSizeChanged: function onSizeChanged() {
var parent = this.node.parent;
if (parent) {
parent.height = this.node.height;
}
},
// 点击触发
onTouch: function onTouch() {
if (this.touchOpened && nx.dt.fnGood(this.touchCB)) {
this.touchCB(this);
}
}
});
cc._RF.pop();