Skip to content

vue-widget #3

@anderkl

Description

@anderkl

/**
* 添加amis事件动作:
* 在这里设置自定义组件对外暴露的动作,其他组件可以通过组件动作触发自定义组件的对应动作
*/
doAction(action, args) {
const actionType = action ? action.actionType : '';
if (actionType === 'message') {
// 接收外部组件的事件动作'message'
alert('您触发了自定义组件的事件动作[message]');
} else {
console.log(
'自定义组件中监听到的事件动作:',
action,
', 事件参数:',
args,
);
}
},

在plugin 中使用
scaffold = {
type: 'vue-info-card',
label: 'vue-info-card',
onEvent: {
click: {
// 监听点击事件
doAction: [
// 执行的动作列表
{
actionType: 'toast', // 执行toast提示动作
args: {
// 动作参数
msgType: 'info',
msg: '派发点击事件',
},
},
],
},
mouseenter: {
// 监听鼠标移入事件
doAction: [
{
actionType: 'toast',
args: {
msgType: 'info',
msg: '派发鼠标移入事件',
},
},
],
},
mouseleave: {
// 监听鼠标移出事件
doAction: [
{
actionType: 'toast',
args: {
msgType: 'info',
msg: '派发鼠标移出事件',
},
},
],
},
},
};
预览中 doAction函数回调不会被触发 是写的有问题嘛 还是bug

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions