mirror of
https://github.com/directus/directus.git
synced 2026-04-25 03:00:53 -04:00
* Add getPresetForCollection method * Add savePreset action * Add useSync composition * Sync collection presets with store / api * Clean up browse flow * Cleanup tabular code * Move portal target to browse page * Save column widths to view options * Add must-sort prop to v-table * Add saving flow for viewQuery / viewOptions * Optimize saving flow * Provide main element to sub components * Add per page option * Add field setup drawer detail
518 B
518 B
Use Sync
function useSync<T, K extends keyof T>(
props: T,
key: K,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
emit: (event: string, ...args: any[]) => void
): Ref<Readonly<T[K]>>
Small utility composition that allows you to easily setup the two-way binding with the prop:
// Before
const _options = computed({
get() {
return props.options;
},
set(val) {
emit('update:options', val);
}
});
// after
const _options = useSync(props, 'options', emit);