@cc-component/cc-ex-component 1.7.2 → 1.7.3
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.
|
@@ -88,6 +88,7 @@ export class ReferenceComponent extends Component {
|
|
|
88
88
|
/** 生成代码基础窗口名称 */
|
|
89
89
|
public baseWindowName = "BaseWindow"
|
|
90
90
|
skipList = ["Button"]//跳过按钮类型
|
|
91
|
+
public addWindow = 'Window'
|
|
91
92
|
protected onLoad(): void {
|
|
92
93
|
if (EDITOR_NOT_IN_PREVIEW) {//处理编辑器逻辑
|
|
93
94
|
this.initNodeList();
|
|
@@ -234,17 +235,17 @@ export class ReferenceComponent extends Component {
|
|
|
234
235
|
let name = key[0].toLowerCase() + key.substring(1);
|
|
235
236
|
const type = this.getPropertyType(data.com)
|
|
236
237
|
let bind_pix = `@Bind`
|
|
237
|
-
let event = `,{ event(this:${className}
|
|
238
|
+
let event = `,{ event(this:${className}${this.addWindow}) { } }`
|
|
238
239
|
if (type === "YXCollectionView") {
|
|
239
240
|
event = `, {
|
|
240
|
-
layout(this:${className}
|
|
241
|
+
layout(this:${className}${this.addWindow}) {
|
|
241
242
|
const layout = new YXFlowLayout();
|
|
242
243
|
layout.horizontalSpacing = 10;
|
|
243
244
|
layout.verticalSpacing = 20;
|
|
244
245
|
layout.itemSize = () => math.size(100, 100);
|
|
245
246
|
return layout;
|
|
246
247
|
},
|
|
247
|
-
cellForItemAt(this:${className}
|
|
248
|
+
cellForItemAt(this:${className}${this.addWindow}, indexPath, collectionView) {
|
|
248
249
|
const node = collectionView.dequeueReusableCell("cell", indexPath);
|
|
249
250
|
//node.getComponent(TableVIewItem).refreshUI(this.viewModel.${name}[indexPath.row])
|
|
250
251
|
return node;
|
|
@@ -255,7 +256,7 @@ export class ReferenceComponent extends Component {
|
|
|
255
256
|
} else if (type === "TableView") {
|
|
256
257
|
event = `, {
|
|
257
258
|
itemSize: () => math.size(100, 100),
|
|
258
|
-
cellForItemAt(this:${className}
|
|
259
|
+
cellForItemAt(this:${className}${this.addWindow}, indexPath, collectionView) {
|
|
259
260
|
const node = collectionView.dequeueReusableCell("cell", indexPath)
|
|
260
261
|
//node.getComponent(TableVIewItem).refreshUI(this.viewModel.${name}[indexPath.row])
|
|
261
262
|
return node
|
|
@@ -384,8 +385,8 @@ const { ccclass, property } = _decorator;
|
|
|
384
385
|
}`
|
|
385
386
|
const classView = `
|
|
386
387
|
@BindViewModel(${className}Data)
|
|
387
|
-
@ccclass('${className}
|
|
388
|
-
export class ${className}
|
|
388
|
+
@ccclass('${className}${this.addWindow}')
|
|
389
|
+
export class ${className}${this.addWindow} extends ViewModel(${this.baseWindowName}) {${sx.text}\n${onload}\n\n${sx.event}\n}`
|
|
389
390
|
|
|
390
391
|
text += classView
|
|
391
392
|
|