Ant-design-vue: 关于table column的scopedSlots

Created on 14 Feb 2020  ·  3Comments  ·  Source: vueComponent/ant-design-vue

  • [ ] I have searched the issues of this repository and believe that this is not a duplicate.

Version

1.4.11

Environment

vue 2.6.10、idea 2019.3

Reproduction link

Edit on CodeSandbox

Steps to reproduce

What is expected?

在vue2.6的版本中 将使用v-slot替代原有的slot 和 slot-scope,并且在官方文档中,写明作用域插槽的内部工作原理是将插槽内容包括在一个传入“单个”参数的函数里,并允许使用结构语法解出单参数中的属性,但是咱们的scopedSlots却是多参数。

What is actually happening?

  1. slot="action" slot-scope="text,record" 的写法在我的idea 2019.3中可以运行,但是标红线,提示语法错误。按照vue文档的写法,此处是否最好是单参数(虽然它不影响运行)?至少多参数肯定无法实现vue官方文档中的解构。@see https://cn.vuejs.org/v2/guide/components-slots.html#%E8%A7%A3%E6%9E%84%E6%8F%92%E6%A7%BD-Prop
  2. 尝试使用v-slot:action="text,record"替代之前的 slot="action" slot-scope="text,record" 无法正常运行

Most helpful comment

#slotname 缩写不会出现警告,可以尝试

      <template #action="text, record">
        <a href="javascript:;">Invite 一 {{record.name}}</a>
        <a-divider type="vertical"/>
        <a href="javascript:;">Delete</a>
        <a-divider type="vertical"/>
        <a href="javascript:;" class="ant-dropdown-link">More actions
          <a-icon type="down"/>
        </a>
      </template>

All 3 comments

多参数改成单参数将是破坏性更新,因为无法做到兼容,所以我们会在2.0版本的时候更改

#slotname 缩写不会出现警告,可以尝试

      <template #action="text, record">
        <a href="javascript:;">Invite 一 {{record.name}}</a>
        <a-divider type="vertical"/>
        <a href="javascript:;">Delete</a>
        <a-divider type="vertical"/>
        <a href="javascript:;" class="ant-dropdown-link">More actions
          <a-icon type="down"/>
        </a>
      </template>

多参数改成单参数将是破坏性更新,因为无法做到兼容,所以我们会在2.0版本的时候更改

想知道为什么在这个可以用多个参数,我试下了vue就是用不了多个参数的呢,是因为antd写组件修改了vue底层么

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YingZzz picture YingZzz  ·  4Comments

ankology picture ankology  ·  3Comments

lostimever picture lostimever  ·  4Comments

oleksii-shaposhnikov picture oleksii-shaposhnikov  ·  4Comments

AndesLai picture AndesLai  ·  4Comments