# 10.3 音乐播放器(Music player)

用于生态接入时,音频播放场景。

# 示例

<template>
  <div class="demo">
    <dof-minibar title="10.1 音乐播放器"> </dof-minibar>
    <SwitchTheme />
    <div class="content-container">
      <dof-music-player
        :volume="30"
        :min="0"
        :max="100"
        :play="playFlag"
        :title="'早间新闻'"
        @dofVolumeChanged="dofVolumeChanged"
        @dofPlayClicked="dofPlayClicked"
        @dofNextClicked="dofNextClicked"
      ></dof-music-player>
      <div class="h-10"></div>
      <dof-music-player
        :volume="50"
        :min="0"
        :max="100"
        :play="!playFlag"
        :title="'早间新闻到底是怎么'"
        @dofVolumeChanged="dofVolumeChanged"
        @dofPlayClicked="dofPlayClicked"
        @dofNextClicked="dofNextClicked"
      ></dof-music-player>
      <div class="h-10"></div>
      <dof-music-player
        :volume="80"
        :min="0"
        :max="100"
        :play="playFlag"
        :title="'早间新闻到底是怎么进行一场场播报的'"
        @dofVolumeChanged="dofVolumeChanged"
        @dofPlayClicked="dofPlayClicked"
        @dofNextClicked="dofNextClicked"
      ></dof-music-player>
    </div>
  </div>
</template>

<script>
import { DofMinibar, DofMusicPlayer } from 'dolphin-weex-ui'
import SwitchTheme from 'src/components/SwitchTheme.vue'
const modal = weex.requireModule('modal')
export default {
  components: {
    DofMinibar,
    DofMusicPlayer,
    SwitchTheme
  },
  data: () => ({
    leftButton: 'http://dolphin-weex-dev.msmartlife.cn/cdn/images/header/icon_back_white@3x.png',
    playFlag: true
  }),
  created() {},
  mounted() {},
  computed: {},
  methods: {
    dofVolumeChanged(val) {
      modal.toast({
        message: val
      })
    },
    dofPlayClicked(type) {
      modal.toast({
        message: type
      })
    },
    dofNextClicked() {
      modal.toast({
        message: 'Next Clicked'
      })
    }
  }
}
</script>

<style scoped>
.demo {
  background-color: #151617;
}
.content-container {
  padding: 32px;
}

.h-10 {
  width: 100%;
  height: 20px;
}
</style>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
点我扫二维码 查看demo
Last Updated: 12/27/2023, 4:50:54 PM