import { _decorator, Component, AudioSource, director, AudioClip } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('TestScene')
export class TestScene extends Component {
    @property(AudioSource)
    audioSource: AudioSource = null!;
    @property(AudioClip)
    audioClip: AudioClip = null!;
    start() {
        this.audioSource.clip = this.audioClip;
        this.audioSource.play();//播放
    }

    btnTest(event) {
        this.audioSource.stop();
        this.audioSource.node.destroy();
        // director.loadScene('TestScene');
    }
}

