diff --git a/src/components/affix/Affix.vue b/src/components/affix/Affix.vue index 9c7386d0f..c5b9beba9 100644 --- a/src/components/affix/Affix.vue +++ b/src/components/affix/Affix.vue @@ -1,77 +1,62 @@ - diff --git a/src/directives/popover/popover.js b/src/directives/popover/popover.js index 755abece3..ded73e66c 100644 --- a/src/directives/popover/popover.js +++ b/src/directives/popover/popover.js @@ -4,9 +4,9 @@ import { hasOwnProperty } from '../../utils/object.utils'; const INSTANCE = '_uiv_popover_instance'; -const bind = (el, binding) => { +const mounted = (el, binding) => { // console.log('bind') - unbind(el); + unmounted(el); const options = []; for (const key in binding.modifiers) { if (hasOwnProperty(binding.modifiers, key) && binding.modifiers[key]) { @@ -54,7 +54,7 @@ const bind = (el, binding) => { el[INSTANCE] = container; }; -const unbind = (el) => { +const unmounted = (el) => { // console.log('unbind') const instance = el[INSTANCE]; if (instance) { @@ -63,11 +63,11 @@ const unbind = (el) => { delete el[INSTANCE]; }; -const update = (el, binding) => { +const updated = (el, binding) => { // console.log('update') if (binding.value !== binding.oldValue) { - bind(el, binding); + mounted(el, binding); } }; -export default { mounted: bind, unmounted: unbind, updated: update }; +export default { mounted, unmounted, updated }; diff --git a/src/directives/scroll.js b/src/directives/scroll.js index 35bb057ea..ecacd65d5 100644 --- a/src/directives/scroll.js +++ b/src/directives/scroll.js @@ -4,29 +4,29 @@ import { isFunction } from '../utils/object.utils'; const HANDLER = '_uiv_scroll_handler'; const events = [EVENTS.RESIZE, EVENTS.SCROLL]; -const bind = (el, binding) => { +const mounted = (el, binding) => { const callback = binding.value; if (!isFunction(callback)) { return; } - unbind(el); + unmounted(el); el[HANDLER] = callback; events.forEach((event) => { on(window, event, el[HANDLER]); }); }; -const unbind = (el) => { +const unmounted = (el) => { events.forEach((event) => { off(window, event, el[HANDLER]); }); delete el[HANDLER]; }; -const update = (el, binding) => { +const updated = (el, binding) => { if (binding.value !== binding.oldValue) { - bind(el, binding); + mounted(el, binding); } }; -export default { mounted: bind, unmounted: unbind, updated: update }; +export default { mounted, unmounted, updated }; diff --git a/src/directives/scrollspy/scrollspy.js b/src/directives/scrollspy/scrollspy.js index f390f049f..e887aa96f 100644 --- a/src/directives/scrollspy/scrollspy.js +++ b/src/directives/scrollspy/scrollspy.js @@ -141,12 +141,12 @@ ScrollSpy.prototype.clear = function () { const INSTANCE = '_uiv_scrollspy_instance'; const events = [EVENTS.RESIZE, EVENTS.SCROLL]; -const bind = (el, binding) => { +const beforeMount = (el, binding) => { // console.log('bind') - unbind(el); + unmounted(el); }; -const inserted = (el, binding) => { +const mounted = (el, binding) => { // console.log('inserted') const scrollSpy = new ScrollSpy(el, binding.arg, binding.value); if (scrollSpy.scrollElement) { @@ -160,7 +160,7 @@ const inserted = (el, binding) => { el[INSTANCE] = scrollSpy; }; -const unbind = (el) => { +const unmounted = (el) => { // console.log('unbind') const instance = el[INSTANCE]; if (instance && instance.scrollElement) { @@ -171,19 +171,19 @@ const unbind = (el) => { } }; -const update = (el, binding) => { +const updated = (el, binding) => { // console.log('update') const isArgUpdated = binding.arg !== binding.oldArg; const isValueUpdated = binding.value !== binding.oldValue; if (isArgUpdated || isValueUpdated) { - bind(el, binding); - inserted(el, binding); + beforeMount(el, binding); + mounted(el, binding); } }; export default { - beforeMount: bind, - unmounted: unbind, - updated: update, - mounted: inserted, + beforeMount, + mounted, + updated, + unmounted, }; diff --git a/src/directives/tooltip/tooltip.js b/src/directives/tooltip/tooltip.js index 88df2f385..e9ae55fc1 100644 --- a/src/directives/tooltip/tooltip.js +++ b/src/directives/tooltip/tooltip.js @@ -5,9 +5,9 @@ import { removeFromDom } from '../../utils/dom.utils'; const INSTANCE = '_uiv_tooltip_instance'; -const bind = (el, binding) => { +const mounted = (el, binding) => { // console.log('bind') - unbind(el); + unmounted(el); const options = []; for (const key in binding.modifiers) { if (hasOwnProperty(binding.modifiers, key) && binding.modifiers[key]) { @@ -55,7 +55,7 @@ const bind = (el, binding) => { el[INSTANCE] = { container, vNode }; }; -const unbind = (el) => { +const unmounted = (el) => { // console.log('unbind', el[INSTANCE]) const instance = el[INSTANCE]; if (instance) { @@ -67,11 +67,11 @@ const unbind = (el) => { delete el[INSTANCE]; }; -const update = (el, binding) => { +const updated = (el, binding) => { // console.log('update', binding.oldValue, '->', binding.value) if (binding.value !== binding.oldValue) { - bind(el, binding); + mounted(el, binding); } }; -export default { mounted: bind, unmounted: unbind, updated: update }; +export default { mounted, unmounted, updated };