-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
使用动态插槽, 并且插槽名称为 #[变量+变量] 时, 插槽无效 (拼接出来的插槽名称开头为undefined) #12945
Comments
I downloaded your project and found it works well. Could you describe it in more details. /** EForm.vue */
<el-form>
<slot name="form_conditionInputs" />
</el-form>
/** DynamicForm.vue */
<e-form :model="formDep.data" :confs="confs" class="DynamicForm">
<template #[form_slot_prefix+confs.conditionInputs.k]>
{{ 'I am here' }}
</template>
</e-form> |
感谢反馈, 用vue-cli创建了一个专门用来复现bug的仓库 https://gitee.com/zzyygg/vue_2_7 |
我也有这种话问题,有方案吗 |
求vue3的写法 |
使用[计算属性]替换复杂的表达式 |
vue2现在好像不支持这种写法 |
这样写应该就行了。 |
set About.vue import { slot_prefix as _slot_prefix } from "../consts";
const slot_prefix = _slot_prefix; |
Version
2.7.14
Reproduction link
gitee.com
Steps to reproduce
!!! 在vue3.2.37中是可以正常工作的, 但是在2.7.14中不行 ( 组件均为 <script setup> )
<template #[form_slot_prefix+confs.conditionInputs.k]>
2.1 这样写是无效的 , 产生的slot名
startsWith("undefined")
, 后半段的值是正确的// form_slot_prefix来源为es6的import
const slotName = form_slot_prefix+confs.conditionInputs.k
<template #[slotName]>
What is expected?
可以这样使用动态插槽名: <template #[form_slot_prefix+confs.conditionInputs.k]>
What is actually happening?
这样写无法工作: <template #[form_slot_prefix+confs.conditionInputs.k]>
The text was updated successfully, but these errors were encountered: