寫了兩個按鈕,用muse-ui.結果第一次關注時無法切換(但請求發出去了,此時點擊其它的“取消關注”才會切換。)刷新后,已是“取消關注”的功能正常。//這是按鈕:<mu-flat-button label="+ 關注" class="demo-flat-button" v-if="!item.user_followed" @click="myFollow(item)" /><mu-flat-button label="已關注" class="demo-flat-button" id="followed" v-else="item.user_followed" @click="unFollow(item)"/>//對應方法及請求methods:{//關注 myFollow (item) { var _this = this; axios.post('關注的請求‘).then(function (res) { item.user_followed = true }) }, //取消關注 unFollow (item) { var _this = this; axios.post('取消關注的請求').then(function (res) { item.user_followed = false }) }}
vue寫一個關注功能,為何第一次關注時切換按鈕不起效?
吃雞游戲
2018-12-12 18:23:13