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

chore(table): watch data add deep on true #3026

Open
wants to merge 1 commit into
base: v4
Choose a base branch
from
Open

Conversation

yangjisen
Copy link
Contributor

这个 PR 做了什么? (简要描述所做更改)

这个 PR 是什么类型? (至少选择一个)

  • feat: 新特性提交
  • fix: bug 修复
  • docs: 文档改进
  • style: 组件样式/交互改进
  • type: 类型定义更新
  • perf: 性能、包体积优化
  • refactor: 代码重构、代码风格优化
  • test: 测试用例
  • chore(deps): 依赖升级
  • chore(demo): 演示代码改进
  • chore(locale): 国际化改进
  • chore: table组件data值增加深度监听

这个 PR 涉及以下平台:

  • NutUI H5 @nutui/nutui
  • NutUI Taro @nutui/nutui-taro

这个 PR 是否已自测:

Copy link

codecov bot commented Apr 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.00%. Comparing base (2a1a4e5) to head (6da4fbc).

Additional details and impacted files
@@            Coverage Diff             @@
##               v4    #3026      +/-   ##
==========================================
- Coverage   84.05%   84.00%   -0.06%     
==========================================
  Files         216      216              
  Lines       23288    23289       +1     
  Branches     2521     2517       -4     
==========================================
- Hits        19575    19563      -12     
- Misses       3695     3708      +13     
  Partials       18       18              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@eiinu
Copy link
Member

eiinu commented Apr 18, 2024

这样修改是用于什么场景呢?
Vue 本身支持了对数组操作的 Proxy,应该不需要添加 deep 🤔

@yangjisen
Copy link
Contributor Author

yangjisen commented Apr 19, 2024

这样修改是用于什么场景呢? Vue 本身支持了对数组操作的 Proxy,应该不需要添加 deep 🤔

<nut-table :columns="columns" :data="items" striped />

当我修改 items里面的属性时, 表格不会自动更新,
或者当我重置 items 时, 数据不会更新

const handleAdd = () => {
state.items.push({
        uuid: uuid,
        name: state.formData.name,
        scope: parseInt(state.formData.scope),
        render: (recode) => {
          return h('button', {
            size: 'mini',
            plain: true,
            shape: 'round',
            onClick: () => state.items = state.items.filter(item => item?.uuid !== recode.uuid)
          }, '删除')
        }
      })
})

const handleReset = () => {
      state.items = []
    }

当我删除(handleReset)了后, 我再追加(handleAdd )的时候, 表格数据不会更新, 但是打印items是有相关的值

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

Successfully merging this pull request may close these issues.

2 participants