avalon.oniui icon indicating copy to clipboard operation
avalon.oniui copied to clipboard

ms-resizable 和ms-repeat联合使用,repeat 出来的子元素不能拖拽,只能拖拽改变大小

Open caixiaojian opened this issue 10 years ago • 1 comments

ms-resizable 和ms-repeat联合使用,repeat 出来的子元素不能拖拽,只能拖拽改变大小 代码示意:

<div ms-controller="demo">
   <div ms-repeat="items" ms-resizable >
       {{el}}
   </div>
</div>
define(["avalon", "../../../common/vendor/oniui/resizable/avalon.resizable"], function(avalon, siderbar) {
    avalon.define({
        $id: "demo",
        items: [1,2,3,4],
        resizable :  {
            start: function() {
                avalon.log("start resize")
            },
            drag: function(e, data) {
                this.style.left = data.startLeft + e.pageX - data.startPageX  + "px"
                this.style.top = data.startTop + e.pageY - data.startPageY  + "px"
            }
        }
    })

})

不知道是不是bug,或者请问怎么才能解决我的需求,我希望可以使数组里的元素具备draggable,resizable的能力

caixiaojian avatar Sep 30 '15 03:09 caixiaojian

这的确是个问题,不过你可以通过直接指定组件的VM和配置项名字来解决,如:

<div ms-controller="test">
    <div ms-repeat="arr">
        <div class="outer" ms-resizable="test, resizable"></div>
    </div>
</div>

yuhaoju avatar Sep 30 '15 09:09 yuhaoju