diff --git a/src/plugins/vue-columns-resizable/index.js b/src/plugins/vue-columns-resizable/index.js index 0523967..f527cc3 100644 --- a/src/plugins/vue-columns-resizable/index.js +++ b/src/plugins/vue-columns-resizable/index.js @@ -2,8 +2,12 @@ export default { install(Vue) { Vue.directive('columns-resizable', { inserted(el) { - const nodeName = el.nodeName; - if (['TABLE', 'THEAD'].indexOf(nodeName) < 0) return; + let nodeName = el.nodeName; + if (['TABLE', 'THEAD'].indexOf(nodeName) < 0) { + el = el.querySelector('table'); // looking for the closest table + if (!el) return; + nodeName = 'TABLE'; + }; const table = nodeName === 'TABLE' ? el : el.parentElement; const thead = table.querySelector('thead');