第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么下面這段js代碼會報, function not found的錯誤呢?

為什么下面這段js代碼會報, function not found的錯誤呢?

FFIVE 2018-11-20 17:14:03
vuex代碼如下export default {    data () {        return {            content: ''        };    },    methods: {        onKeyup (e) {            if (e.ctrlKey && e.keyCode === 13 && this.content.length) {                this.sendMessage(this.content);                this.content = '';            }        },        sendMessage (content) {            store.dispatch('sendMessage', content);        }    }};執(zhí)行到onKeyup 的時候, 提示Uncaught TypeError: this.sendMessage is not a function, 是不是我哪里寫錯了, 我還沒看出來。 。 。 看出來的給指教一下哈, 多謝。
查看完整描述

1 回答

?
慕尼黑的夜晚無繁華

TA貢獻1864條經(jīng)驗 獲得超6個贊

一般來說用vuex的寫法應該是
sendMessage (content) {

this.$store.dispatch('sendMessage', content);

}

然后在actions里注冊 sendMessage 這個方法。
記得不要忘了 mutations.js也要寫上


查看完整回答
反對 回復 2018-12-28
  • 1 回答
  • 0 關注
  • 1269 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號