• 示例
// TestTs.ts文件:
@ccclass("TestTS")
export class TestTS extends Component {
    play () {
        console.log('play')
    }
}
 
// TestJs.js文件
import TestTS from "./TestTS"
var TestJs = cc.class({
    extends: cc.Component,
    
    start(){ 
        let ts = new TestTS()
        ts.play()
    }
});
  • 若调用非class的module.exports,使用require;

点赞(0)

微信小程序

微信扫一扫体验

微信公众账号

微信扫一扫加关注

返回
顶部