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

table 使用 template 风格的 API #216

Closed
jahnli opened this issue Jun 21, 2021 · 16 comments
Closed

table 使用 template 风格的 API #216

jahnli opened this issue Jun 21, 2021 · 16 comments

Comments

@jahnli
Copy link
Collaborator

jahnli commented Jun 21, 2021

This function solves the problem (这个功能解决的问题)

Expected API (期望的 API)

<n-table-column key="action" title="Action"> <template slot-scope="text, record"> </template> </n-table-column>

@XieZongChen
Copy link
Collaborator

出于:
1. 维护成本
2. TypeScript 支持
暂时不考虑增加相应插槽

@xxholly32
Copy link

{
  title: 'Tags',
  key: 'tags',
  render (row) {
    const tags = row.tags.map((tagKey) => {
      return h(
        NTag,
        {
          style: {
            marginRight: '6px'
          },
          type: 'info'
        },
        {
          default: () => tagKey
        }
      )
    })
    return tags
  }
}

我可以理解定义columns作为json带来的好处,但大部分用户是不太爱用h,其实我们业务为了适应多语言环境基本都不能用span,都要封装一层 自动省略的组件,所以可能每个col都是要写一个h;相当恶心

@07akioni
Copy link
Collaborator

可以理解大家的想法,但是在 vue 明确 slot 的类型之前我们不会增加这类 API,到时候如果产生了 breaking changes 大家都会很难受,这是特定的代价,没有办法在每个时刻让每个人都满意。

@jahnli jahnli mentioned this issue Jul 21, 2021
@07akioni
Copy link
Collaborator

@07akioni image
3.2 In BATA, has the author given the solution

他这个评论我看到了,还没空研究,这是 volar 专有的特性?

@07akioni
Copy link
Collaborator

07akioni commented Jan 5, 2022

因为没有插槽,使用体验非常非常非常糟糕!

目前整个 vue 生态的 ts 支持好了一些,会考虑逐步添加 slots 了。

会先在简单的组件做一些实验。

@qingmang
Copy link

qingmang commented Mar 3, 2022

能否优先考虑这个

@oooowl
Copy link

oooowl commented Apr 18, 2022

+1,后台业务中会大量用到table等组件,用slot写法会很有效率

@qingmang
Copy link

07akioni 这个今年还没计划吗 @07akioni

@07akioni
Copy link
Collaborator

07akioni 这个今年还没计划吗 @07akioni

暂时没有

@GuoChang2032
Copy link

太可惜了,表格不支持插槽很难受,其他都很好,唯独这一点效率很低

@yajore
Copy link

yajore commented Jul 5, 2022

vue3不是老早都支持了吗,依然不肯跟进。。

@chenbimo
Copy link

真难受,只能换其他UI组件库了。

@gzlboy
Copy link

gzlboy commented Jan 4, 2023

不支持插槽,非常难受!

@fudiwei
Copy link

fudiwei commented Aug 21, 2023

毛遂自荐 @skit/x.naive-ui,基于 Naive-UI 二次封装了 DataTable 组件,完全兼容一致的 API,且支持插槽式的写法。

@dengsong666
Copy link

可以理解大家的想法,但是在 vue 明确 slot 的类型之前我们不会增加这类 API,到时候如果产生了 breaking changes 大家都会很难受,这是特定的代价,没有办法在每个时刻让每个人都满意。

快2024年了,有计划支持了吗?我了解到vue3.3已经开始支持slot类型了

@Cat7373
Copy link

Cat7373 commented Apr 17, 2024

已经 2024 年了

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

No branches or pull requests

14 participants