123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <template>
- <!-- 播放器 -->
- <view class="audio" :style="{ 'background': (bg ? `url(${bg}) no-repeat 100% / 100%` : '#EEE') }">
- <image class="pic" :src="pic" />
- <view class="info">
- <view class="song">{{ name }}</view>
- <view class="singer">{{ singer ? singer : '暂无歌手名' }}</view>
- </view>
- <image v-if="newStatus !== 1" class="btn" src="../../static/play.png" @click="getPlay" />
- <image v-else class="btn" src="../../static/stop.png" @click="getPlay" />
- </view>
- </template>
- <script>
- export default {
- props: {
- bg: String,
- pic: String,
- name: String,
- status: Number,
- singer: String
- },
- data() {
- return {
- newStatus: this.status
- }
- },
- watch: {
- status(val) {
- this.newStatus = val
- }
- },
- methods: {
- getPlay() {
- this.$emit('click')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .audio {
- width: 100%;
- height: 104px;
- padding: 8px 16px 8px 8px;
- border-radius: 8px;
- display: flex;
- align-items: center;
- font-weight: bold;
- .pic {
- width: 88px;
- height: 88px;
- border-radius: 8px;
- margin-right: 16px;
- }
- .info {
- width: calc(100% - 144px);
- color: #000;
- .song {
- font-size: 16px;
- margin-bottom: 16px;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- .singer {
- font-size: 12px;
- opacity: 0.6;
- overflow: hidden;
- white-space: nowrap;
- text-overflow: ellipsis;
- }
- }
- .btn {
- width: 40px;
- height: 40px;
- }
- }
- </style>
|