You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Out-of-the-box, `v-tree-vue` ships with default behaviors like double clicking an item to rename, pushing the `DEL` key to delete and moving (drag-and-drop) items into new locations. However, this is totally customisable. The default command API exposes the following configurations:
198
+
199
+
```ts
200
+
exportinterfaceDefaultBehaviors {
201
+
// Allow customisation of items that can be renamed on the tree.
202
+
enableRenaming(type:string):void;
203
+
// Allow customisation of items that can be deleted on the tree.
204
+
enableDeleting(type:string):void;
205
+
// Allow registration of handler to be called when an item of a particular type has been deleted.
## One Handler for all Types ? (We've got you covered).
218
+
219
+
In many cases and existing apps, a single handler is called whenever an item is renamed or deleted irrespective of it's type. This handler may then make an API call that takes care of the rest.
220
+
221
+
To do so when calling the `registerItemRenamedHandler` or `registerItemDeletedHandler` pass 'ANY_TYPE' as the `type` property. The `callback` will be called whenever ANY item is renamed or deleted.
222
+
223
+
```ts
224
+
import { ANY_TYPE } from'@/constants.ts';
225
+
```
181
226
227
+
> This avoids moving magic strings around and provides a central point of change in the future should the need arise. However, you can get rid of the extra import statement and use a string with value 'ANY_TYPE'.
0 commit comments