✨ (spotify) play and pause when controlling
This commit is contained in:
@@ -23,8 +23,19 @@ export default defineComponent({
|
||||
required: true
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const { ready, play, pause } = useSpotify()
|
||||
setup(props, { emit }) {
|
||||
const onPlay = () => {
|
||||
if (!props.play) {
|
||||
emit('play')
|
||||
}
|
||||
}
|
||||
|
||||
const onPause = () => {
|
||||
if (props.play) {
|
||||
emit('pause')
|
||||
}
|
||||
}
|
||||
const { ready, play, pause } = useSpotify(onPlay, onPause)
|
||||
|
||||
watchEffect(() => {
|
||||
props.play ? play() : pause()
|
||||
|
||||
Reference in New Issue
Block a user