[LayaAir1]关于layaUI.max.all.js导出代码为ES6语法的问题。
刚接触laya,碰到了一个老项目,我发现原项目导出的layaUI.max.all.js中的代码是用class和es6语法来声明类。类似下面这样。
我想请教一下要如何改变layaUI.max.all导出的格式呢?希望大佬能帮我解答一下,谢谢。
class ClassName extends SuperClass {而我创建了新的UI组件后,导出的时候代码格式就变成了使用传统的函数式原型继承模式,类似下面这样
constructor() {
super();
}
createChildren() {
super.createChildren();
this.createView(ClassName.uiView);
}
}
ClassName.uiView = {
"type": "Dialog",
"props": {"width": WidthValue, "height": HeightValue},
"child": [
{"type": "Sprite", "props": {"y": YValue, "x": XValue, "var": "VarName", "alpha": AlphaValue}, "child": [
{"type": "Rect", "props": {"y": YValue, "x": XValue, "width": WidthValue, "lineWidth": LineWidthValue, "height": HeightValue, "fillColor": "FillColor"}}
]},
{"type": "Sprite", "props": {"y": YValue, "x": XValue, "width": WidthValue, "var": "VarName", "height": HeightValue}, "child": [
{"type": "Image", "props": {"width": WidthValue, "skin": "SkinPath", "name": "Name", "height": HeightValue}},
// ...
]}
]
};
deepReplaceUrl(ClassName.uiView);
REG("ui.ClassName", ClassName);
var ClassName = (function(_super) {
function ClassName() {
this.VarName1 = null;
this.VarName2 = null;
// ...
ClassName.__super.call(this);
}
CLASS$(ClassName, 'ui.ClassName', _super);
var __proto__ = ClassName.prototype;
__proto__.createChildren = function() {
View.regComponent("ComponentName", ComponentClass);
laya.ui.Component.prototype.createChildren.call(this);
this.createView(ClassName.uiView);
}
ClassName.uiView = {
"type": "Dialog",
"props": {"width": WidthValue, "height": HeightValue},
"child": [
{"type": "Sprite", "props": {"y": YValue, "x": XValue, "var": "VarName", "alpha": AlphaValue}, "child": [
{"type": "Rect", "props": {"y": YValue, "x": XValue, "width": WidthValue, "lineWidth": LineWidthValue, "height": HeightValue, "fillColor": "FillColor"}}
]},
{"type": "Sprite", "props": {"y": YValue, "x": XValue, "width": WidthValue, "var": "VarName", "height": HeightValue}, "child": [
{"type": "Image", "props": {"width": WidthValue, "skin": "SkinPath", "name": "Name", "height": HeightValue}},
// ...
]}
]
};
return ClassName;
})(Dialog);
我想请教一下要如何改变layaUI.max.all导出的格式呢?希望大佬能帮我解答一下,谢谢。
没有找到相关结果
已邀请:
要回复问题请先登录
1 个回复
layabox
赞同来自: