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

[Loading Component]Loading组件的v-model设计是否不合理? #1798

Closed
Plortinus opened this issue Aug 5, 2017 · 4 comments
Closed

Comments

@Plortinus
Copy link
Contributor

  1. vue2.4.2版本中给computed里的属性加了限制,详见assigning to a computed property without setter does not fail
  2. 项目将vue升级之后,配合vux官网的页面切换显示loading代码,会报错[Vue warn]: Computed property "isLoading" was assigned to but it has no setter.
  3. vue的issue里问了一下,是因为Loading组件绑定值的时候用的v-model导致的,改成:value="isLoading"那个warn就不会出现了。
  4. 想了一下这个Loading组件的作用,又看了一下Element设计的Loading组件,我认为Loading组件的这个是否显示的属性不需要用v-model绑定
  5. 用v-model来实现数据的双向绑定,在Loading这个组件里,没看到什么用处,是否还有别的场景会需要用v-model来实现呢?
@airyland
Copy link
Owner

airyland commented Aug 5, 2017

这是不得已为之,vue2 废弃了 sync,只有 v-model 才能直接实现双向绑定,而 2.3 又把 sync 放回来,2.4 加了进一步的限制。所以这里组件代码又要改了。使用 v-model 在当时是为了统一绑定方式预留可能存在的内部状态更改实现的可能性。

@eggbucket
Copy link

什么时候更新vux呢?

@q27488
Copy link

q27488 commented Sep 19, 2017

刚好项目遇到了这个报错,查了下,确实是因为在 loading组件使用v-model去绑定 vuex的值。
导致报错:
Computed property "alertShow" was assigned to but it has no setter.
目前该如何解决?
(虽然报错,但是功能还是能用的)

@airyland
Copy link
Owner

@q27488 这个问题已经修复很久了,提问时请先看看版本吧。

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

4 participants