- 示例
// 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
;