web123456

Vue implementation of the audio file playback function

  • <script>
  • data() {
  • return {
  • src: "",
  • dialogVisible: false,
  • }
  • methods: {
  • //Playback components
  • handlePlay(row) {
  • this.src = row.filePath;
  • this.play();
  • });
  • },
  • //play
  • play() {
  • this.dialogVisible = true;
  • this.$refs.audio.play();
  • },
  • //audio pause
  • stop() {
  • this.dialogVisible = false;
  • this.$refs.audio.pause();
  • this.$refs.audio.currentTime = 0;
  • }
  • }
  • </script>