Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-widget #3

Open
anderkl opened this issue Nov 10, 2024 · 0 comments
Open

vue-widget #3

anderkl opened this issue Nov 10, 2024 · 0 comments

Comments

@anderkl
Copy link

anderkl commented Nov 10, 2024

/**
* 添加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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant