Skip to content

Commit

Permalink
Fix data watch deep cause by selected bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhixin committed Jul 5, 2024
1 parent c819ae4 commit b57ec7d
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "multiple-select",
"main": "dist/multiple-select.min.js",
"module": "dist/multiple-select-es.min.js",
"version": "2.0.8",
"version": "2.0.9",
"type": "module",
"title": "Multiple Select",
"description": "Multiple select is a jQuery plugin to select multiple elements with checkboxes :).",
Expand Down
10 changes: 9 additions & 1 deletion src/MultipleSelect.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,15 @@ class MultipleSelect {
value: it
}
}
return it

if (it.children?.length) {
return {
...it,
children: it.children.map(it => ({ ...it }))
}
}

return { ...it }
})
} else if (typeof this.options.data === 'object') {
for (const [value, text] of Object.entries(this.options.data)) {
Expand Down
2 changes: 1 addition & 1 deletion src/vue/MultipleSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export default {
single: !this.multiple,
width: this.width,
size: this.size,
data: deepCopy(this.data)
data: this.data
}
if (!this._hasInit) {
Expand Down
7 changes: 6 additions & 1 deletion vue-examples/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ export default defineConfig({
],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url))
'@': fileURLToPath(new URL('./src', import.meta.url)),
...process.env.NODE_ENV === 'production' ?
{} :
{
'multiple-select': fileURLToPath(new URL('../', import.meta.url))
}
},
extensions: ['.js', '.vue', '.json']
},
Expand Down

0 comments on commit b57ec7d

Please sign in to comment.