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

[Bug Report] Element UI Table Column that uses slot-scope Issue “Cannot read property 'column_name' of undefined” #14303

Closed
japhfortin opened this issue Feb 5, 2019 · 7 comments

Comments

@japhfortin
Copy link

japhfortin commented Feb 5, 2019

Element UI version

2.5.4

OS/Browsers version

Win10

Vue version

2.6.2

Reproduction Link

https://jsfiddle.net/japhfortin/jkzma0v8/3/

Steps to reproduce

  • create element ui table
  • use slot-scope on 1 column

What is Expected?

No error on the console

What is actually happening?

Error in the console says:
[Vue warn]: Error in render: "TypeError: Cannot read property 'column_name' of undefined"

@fabioanderegg
Copy link

I have the same problem after upgrading to Vue 2.6.2. My workaround is to add a v-if around the cell content: https://jsfiddle.net/xuo0hkfv/

@kfeng0806
Copy link

I have same problem with Vue 2.6.2

@sigfriedseldeslachts
Copy link

I have the same issue after updating.
I fixed it by doing this shady thingie:
scope.row ? scope.row.title : ''

Not perfect, but it works. Not sure this is a Element UI problem tho. It might be something with vue.

@kfeng0806
Copy link

@sigfriedseldeslachts
I will not going do this for each row...
I think maybe some breaking changes in slot from Vue 2.6
https://medium.com/the-vue-point/vue-2-6-released-66aa6c8e785e

@japhfortin
Copy link
Author

The problem is if we already have lots of tables and cells that need updating. I downgraded the vuejs to 2.5.4, which is the last working version after I updated the packages. Now everything's back to normal. The best thing to do I guess is to just wait on the next update of element -ui.

@onlunar
Copy link

onlunar commented Feb 6, 2019

The problem is if we already have lots of tables and cells that need updating. I downgraded the vuejs to 2.5.4, which is the last working version after I updated the packages. Now everything's back to normal. The best thing to do I guess is to just wait on the next update of element -ui.

@japhfortin Agreed.

It turns out that the slot-scope is deprecated in the latest release from Vue 2.6#slot-scope,scope as well,which was replaced with a new directive v-slot.

It caused me so much trouble like lots of "undefined"s and column misplacement in the Table component that I had to rollback to Vue 2.5.22.

As for the temporary solutions mentioned above,I'm afraid adding those conditional operator to each column of all tables in all pages won't be much of a good idea.

Tried to fix some column with the new directive v-slot and failed.The Table component is most likely rendered before the v-slot is even compiled,reading properties from a yet undefined scope,hence the "undefined" errors. Could this mean the v-slot is faster than slot-scope? :D

Anyway,the upcoming update of element-ui should fix this problem,but before that,stay on Vue 2.5.x ;)

@bezany
Copy link
Contributor

bezany commented Feb 6, 2019

Problem fix in vue 2.6.3.
Example: https://jsfiddle.net/bezanyu/0pdz5rua/
Related issue in vue: vuejs/vue#9421
Source of problem in code like this this.$slots.default (for example here)
In vue 2.6.2 expose all scoped slots on this.$slots. And if exist default scoped slot and not exist simple default slot then instuction this.$slots.default call scoped slot without arguments.
In vue 2.6.3 this change reverted.

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

6 participants