首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从interact js "interact('.dropzone').dropzone访问属性

从interact js "interact('.dropzone').dropzone访问属性
EN

Stack Overflow用户
提问于 2020-03-10 23:34:00
回答 1查看 63关注 0票数 0

我尝试访问ondrop函数中的道具(可能稍后还会访问其他道具),但我无法从那里访问道具。以下是代码

‘interact(’.dropzone‘).dropzone({ //可拖放区域重叠中可接受的最小百分比: 1,

代码语言:javascript
复制
// listen for drop related events:

ondropactivate: function (event) {
    // add active dropzone feedback
    event.target.classList.add('drop-active')
},
ondragenter: function (event) {
    var draggableElement = event.relatedTarget
    var dropzoneElement = event.target

    // feedback the possibility of a drop
    dropzoneElement.classList.add('drop-target')
    draggableElement.classList.add('can-drop')
},
ondragleave: function (event) {
    event.target.classList.remove('drop-target')
    event.relatedTarget.classList.remove('can-drop')
},
ondrop: function (event) {
    //TODO: rerender widget dragables, save position into store
    let availableOptions = JSON.parse(event.dragEvent.currentTarget.dataset.options).avalibaleOptions
    for( let i=0 ; i < availableOptions ; i++ ) {
        this.props.change(availableOptions);
    }
    console.log("position: ", event.dragEvent.rect)
    console.log("welche Daten sind enthalten?", JSON.parse(event.dragEvent.currentTarget.dataset.options) )
    //löschen und neu erstellen? in den state schreiben reicht? ...
},
ondropdeactivate: function (event) {
    // remove active dropzone feedback
    event.target.classList.remove('drop-active')
    event.target.classList.remove('drop-target')
}

})‘this.props.change(availableOptions)是一个缩减程序。它的目的是根据div的数据和坐标更改存储。

我还没有找到任何如何解决它的线索。

EN

回答 1

Stack Overflow用户

发布于 2020-03-12 16:01:02

经过几次尝试,我只是导入了存储并直接使用了store.dispatch()...

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/60620919

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档