克隆后,如何移除Dragula中的元素?

时间:2018-12-06 10:08:20

标签: javascript html dragula

从父容器public static boolean savePropertiesToURL(Properties properties, String link, String fileName) { boolean result = false; if (properties != null && link != null && fileName != null) { try { URL url = new URL(link); try { URLConnection connection = url.openConnection(); connection.setDoOutput(true); try { OutputStream outStream = connection.getOutputStream(); try { properties.store(outStream, fileName); } catch (IOException ex) { System.err.println("Unable to store the properties: " + ex.getMessage()); } finally { try { outStream.flush(); result = true; } catch (IOException ex) { Logger.getLogger(PropertiesUtil.class.getName()).log(Level.SEVERE, null, ex); System.err.println("Unable to flush outputstream: " + ex.getMessage()); } outStream.close(); } } catch (IOException ex) { System.err.println("Unable to get outputstream: " + ex.getMessage()); } } catch (IOException ex) { System.err.println("Unable to open URL connexion: " + ex.getMessage()); } } catch (MalformedURLException ex) { System.err.println("The URL hasn't been created: " + ex.getMessage()); } } return result; } 拖动元素之后,我希望从克隆容器id=left-copy-1tomany中删除一些克隆的元素。我想使用id=right-copy-1tomany函数将其删除,该函数应让我将元素拖出容器以将其删除。有没有办法使克隆代码起作用?

HTML

removeOnSpill: true

JS

<div class='parent'>
    <div class='wrapper'>
        <div id='right-copy-1tomany' class='container'></div>
            <div id='left-copy-1tomany' class='container'>
                <div>TEST BOX 1</div>
                <div>TEST BOX 2</div>
                <div>TEST BOX 3</div>
                <div>TEST BOX 4</div>
                <div>TEST BOX 5</div>
            </div>
        </div>
    </div>
</div>

<h4>Dragule Code:</h4>

1 个答案:

答案 0 :(得分:0)

dropModel()事件中尝试使用el.remove()

 this.dragulaService.dropModel("<dragula-id>")
  .subscribe(({ name, el, target, source, sibling, sourceModel, targetModel, item }) => {
    if (<condition-to-remove>) {
       el.remove()
    }
  });