Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overriding scoped slots to pass in custom props rather than the context object #554

Open
woahitsjc opened this issue Jul 27, 2022 · 2 comments
Labels
feature request New feature or request

Comments

@woahitsjc
Copy link

woahitsjc commented Jul 27, 2022

I would like a way to create a custom input that allows to override the predefined scoped slots i.e. default but rather than passing in the context object prop to use a custom prop provided in the custom input.

The specific use case is to create a custom Select component that calls the server to retrieve the data as options, which can then be displayed as option labels that can be customised. (I am thinking the best way would be through the Select's default scoped slot where this server data is passed down to.

For example:

Slot Component:

<template>
    <CustomSelect
        ...otherProps 
        v-model="context.model"
        :api-url="apiUrl"
    >
        <template slot="option" slot-scope="props">
            <slot name="default" :props="props" /> //props contains data coming from an API response in Custom Select component
        </template>
    </CustomSelect>
</template>

Formulate Input using Custom Select:

<formulate-input 
    ...otherProps
    type="customselect"
>
    <template #default="props"> // This is getting the object context, is there a way to get custom props?
        {{ props.data.optionLabel }}
    </template>
</formulate-input>
@woahitsjc woahitsjc added the feature request New feature or request label Jul 27, 2022
@kconde2
Copy link

kconde2 commented Aug 22, 2022

Hello,

Exactly what I am trying to do here https://codesandbox.io/s/vue-formulate-custom-input-slot-forked-yb3xyk. But it doesn't seems to work.

Any update ?

Thanks in advance.

@kconde2
Copy link

kconde2 commented Oct 10, 2022

Any updates ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants