关于require的问题。版本creator2.0

var gameView = require("../UI/Game/GameView");
 properties: {
     GameView:{
         default : null,
         type : gameView
     },
}
onLoad () {
    cc.loader.loadRes("conf/grade", function (err, results) {
        this.GameView.init(this);
    }.bind(this));
}

有没有大佬知道这是什么原因。好像在真机上会导致闪屏。。

GameView需要通过编辑器中的属性面板进行配置后再使用,同时修改代码:

var gameView = require("../UI/Game/GameView");

properties: {
    GameView:{
        default : null,
        type : gameView
},

改为

properties: {
    GameView:{
        default : null,
        type : require("GameView")
},

另外GameView组件上挂在的scripte貌似也有问题,你检查一下,是缺少还是脚本错误?

谢谢大佬。

我查了一下。。一直在报这个错。没发现影响程序运行。。不太明白是什么错误。。
A Class already exists with the same classname : “GameView”.

代码已改为
GameView:{
default : null,
type : require("…/UI/Game/GameView")
},

之前的问题是有时候刷新浏览器之后会偶尔出现。现在暂时还没有出现问题~

require不需要加相对路径,就像引擎组回复的那样,直接文件名就好

好的。谢谢大佬~