@egjs/vue-children-differ

A Vue directive that checks diff when child elements are added, removed, or changed

Usage no npm install needed!

<script type="module">
  import egjsVueChildrenDiffer from 'https://cdn.skypack.dev/@egjs/vue-children-differ';
</script>

README

@egjs/vue-children-differ

version Travis (.org) Coveralls github npm downloads per month GitHub

➕➖🔄 A Vue directive that checks diff when child elements are added, removed, or changed.

⚙️ Installation

$ npm i @egjs/vue-children-differ

📖 Documentation

🏃 Quick start

import Vue from "vue";
import ChildrenDiffer from "@egjs/vue-children-differ";

Vue.directive("children-differ", ChildrenDiffer);
<template>
  <div id="wrapper" v-children-differ="foo"></div>
</template>
<script>
  export default {
    methods: {
      foo(diffResult) {
        // This will be called when child nodes of #wrapper is changed

        /*
         * This is called before lifecycle "updated",
         * so if you have to change state in this method,
         * you can use either "this.$nextTick"
         * or assign diffResult to other variable, then handle it on "updated" lifecycle.
         */
      }
    }
  }
</script>

📝 Feedback

Please file an Issue.

📜 License

@egjs/vue-children-differ is released under the MIT license.

Copyright (c) 2019-present NAVER Corp.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.