Quantcast
Channel: Cocos中文社区 - 最新主题
Viewing all articles
Browse latest Browse all 88737

一个Class的属性是另一个Class的类型, 如何初始化?

$
0
0

@jumpchess1 写道:

AAA.js

var BBB = require("BBB");
cc.Class({
    extends: cc.Component,
    properties: {
        bbb: {
            default: null,
            type: BBB,
        }
    },
    onLoad: function () {
        bbb = new BBB();
    },    
});

BBB.js

var BBB = cc.Class({
    name: "BBB",
...
});
module.exports = BBB;

为什么运行报错 Uncaught ReferenceError: bbb is not defined

帖子: 2

参与者: 1

阅读整个主题


Viewing all articles
Browse latest Browse all 88737

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>