diff --git a/.storybook/composable/useArgs.ts b/.storybook/composable/useArgs.ts new file mode 100644 index 000000000..2b15e8858 --- /dev/null +++ b/.storybook/composable/useArgs.ts @@ -0,0 +1,21 @@ +import { + computed, + useAttrs, +} from "vue"; + +export function useArgs(excludedAttrs:string[] = []) { + const attrs = useAttrs(); + const args = computed(() => (Object.keys(attrs).reduce((object, key) => { + if (!excludedAttrs.includes(key)) { + return { + ...object, + [key]: attrs[key], + }; + } + return object; + }, {}))); + return { + attrs, + args + } +} \ No newline at end of file diff --git a/.storybook/decorators/withVModel.ts b/.storybook/decorators/withVModel.ts index 6dcdfa4c0..d8803ebe9 100644 --- a/.storybook/decorators/withVModel.ts +++ b/.storybook/decorators/withVModel.ts @@ -1,4 +1,5 @@ import { + ref, computed, defineComponent, provide, @@ -13,9 +14,11 @@ export const withVModel = (story, { id, args }) => { name: 'DWithVModel', inheritAttrs: false, setup() { + const modelValueFallback = ref(null) const modelValue = computed({ - get: ()=>(args.modelValue), + get: ()=>(modelValueFallback.value || args.modelValue), set: (newValue) => { + modelValueFallback.value = newValue; updateArgs({ modelValue: newValue }); } }) diff --git a/src/components/organisms/UiHorizontalPaging/stories/MobileMenu.vue b/src/components/organisms/UiHorizontalPaging/stories/MobileMenu.vue index 246d13c07..d5960d2f6 100644 --- a/src/components/organisms/UiHorizontalPaging/stories/MobileMenu.vue +++ b/src/components/organisms/UiHorizontalPaging/stories/MobileMenu.vue @@ -26,7 +26,7 @@ ref="horizontalPagingTemplateRefs" v-model="value" v-bind="args" - :menu-template-refs="menuTemplateRef" + :menu-template-ref="menuTemplateRef" >