how to set slot's default name #9484
Unanswered
codesyofo
asked this question in
Help/Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
// a.vue <scirpt setup> const list = [ {prop: 'a1'}, {prop: 'a2'} ] </script> <template> <template v-for="{prop} in list" :key="prop"> <slot :name="prop[?1]" v-bind={...} /> </template> </template>
// b.vue <scirpt setup> import CompA from './a.vue' </script> <template> <comp-a> <template #[?2]="{...}"></template> </comp-a> </template>
如何在
[?1]
设置参数同时支持默认插槽名和动态插槽名?[?2]
默认插槽名和动态插槽名都可用,默认插槽名优先级低于动态插槽名这种方式可行,但传递参数过多且相同就会有些不方便
两者并行,
common
优先级低于a1
期望效果
或者其他方案?
Beta Was this translation helpful? Give feedback.
All reactions