Skip to content

Commit e6af794

Browse files
committed
bugfix: when $attrs is updated before mounted, throw: Uncaught (in promise) TypeError: Cannot read property 'option' of undefined. Because the variable _sortable has not been initialized.
1 parent f66e77a commit e6af794

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/vuedraggable.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const draggableComponent = defineComponent({
165165
$attrs: {
166166
handler(newOptionValue) {
167167
const { _sortable } = this;
168+
if (!_sortable) return;
168169
getValidSortableEntries(newOptionValue).forEach(([key, value]) => {
169170
_sortable.option(key, value);
170171
});

0 commit comments

Comments
 (0)