鍍金池/ 問(wèn)答/網(wǎng)絡(luò)安全  HTML/ iview this.$Message.info報(bào)錯(cuò)

iview this.$Message.info報(bào)錯(cuò)

表格內(nèi)點(diǎn)擊一個(gè)用render渲染出的按鈕,按鈕彈出文字提示氣泡(Poptip -- confirm),點(diǎn)擊確定后報(bào)錯(cuò)

  • 代碼如下
render: (h, params) => {
            return h('div', [
                h('Button',{
                    props: {
                        type: 'primary'
                    },
                    style: {
                        marginRight: '8px'
                    },
                    on: {
                        click: () => {
                            this.$Message.info('點(diǎn)擊了');
                        }
                    }
                }, '編輯'),
                h('Poptip',{
                    props: {
                        confirm: true,
                        title: '您確認(rèn)刪除這條內(nèi)容嗎?',
                        placement: 'bottom'
                    },
                    on: {
                        'on-ok': () => {
                            this.$Message.info('點(diǎn)擊了確定');
                        },
                        'on-cancel': () => {
                        }
                    }
                }, [
                    h('Button',{ props: { type: 'error' } },'刪除')
                ])
            ]);
        }
  • 報(bào)錯(cuò)如下

圖片描述

圖片描述

  • 在methods中使用并不會(huì)報(bào)錯(cuò)。有大神解決一下嗎?謝謝!
回答
編輯回答
愚念
on: {
    'on-ok': () => {
        this.$Message.info('點(diǎn)擊了確定');
    },
    'on-cancel': () => {
    }
}

這里不能綁定 on-ok事件 ,只能綁定 click事件這類(lèi)

2017年5月10日 10:26