如何访问计算的属性?

问题描述 投票:0回答:1
vue.js
1个回答
0
投票
所说,它自我的问题没有说明如何定义商店代码。因此,很难理解上下文。

我的猜测是,当您定义歌曲计算的属性时,它与V-For循环中的歌曲变量发生冲突。但这是迄今为止我可以猜到的,除非您提供更多信息。 <script lang="ts" setup> const songStore = useSongStore(); const songList = computed(() => songStore.songList.value); const currentSong = computed(() => songStore.getCurrentSong.value); </script> <template> <ul> <li v-for="(song, $song_index) in songList" :key="song.id" :class="{'current-play' : song.id === currentSong.id}" > {{ $song_index + 1 }} - {{ song?.name }} </li> </ul> </template>

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.