Mint-ui: [Vue warn]: Computed property "values" was assigned to but it has no setter.

Created on 24 Jul 2017  ·  21Comments  ·  Source: ElemeFE/mint-ui

Mint UI version

2.2.7

OS/Browsers version

macos 10.12.5 /61.0.3159.5(正式版本)dev (64 位)

Vue version

2.4.2

Reproduction Link

https://jsfiddle.net/pj71jkyw/397/

Steps to reproduce

打开jsfiddle 并打开控制台 控制台上会显示

[Vue warn]: Computed property "values" was assigned to but it has no setter.

found in

---> <MtPicker>
       <Root>
        warn    @   vue.js:485
sharedPropertyDefinition.set    @   vue.js:3251
created @   index.js:2
callHook    @   vue.js:2669
Vue._init   @   vue.js:4217
VueComponent    @   vue.js:4387
createComponentInstanceForVnode @   vue.js:3676
init    @   vue.js:3493
createComponent @   vue.js:5138
createElm   @   vue.js:5081
createChildren  @   vue.js:5209
createElm   @   vue.js:5114
patch   @   vue.js:5597
Vue._update @   vue.js:2418
updateComponent @   vue.js:2542
get @   vue.js:2883
Watcher @   vue.js:2872
mountComponent  @   vue.js:2546
Vue$3.$mount    @   vue.js:7854
Vue$3.$mount    @   vue.js:10057
(anonymous) @   Inline Babel script:41
run @   babel.js:60802
check   @   babel.js:60868
loadScripts @   babel.js:60909
runScripts  @   babel.js:60936
transformScriptTags @   babel.js:324

What is Expected?

不提示warn 信息(对mtpicker的计算属性values添加setter方法)

What is actually happening?

提示warn 信息

Most helpful comment

Please reply in English

All 21 comments

我也遇到了这个问题,mint-ui与vue2.4版本的兼容问题,先退回vue2.3.4

第一次用vue就碰到这个问题,纠结了两天,原来是兼容问题。。。。。。。。。。。

element 也有这个问题啊

@win5do 我就是2.3.4版本,同样这个问题

@win5do 错了,2.3.4版本确实没问题

是吗 我昨天回退了 还有这个问题呢

发自网易邮箱大师
在2017年07月27日 15:07,undefined 写道:

@win5do 错了,2.3.4版本确实没问题


You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

@FrozenByzz 那你回退到2.3.4 解决了没啊

@lzt9977 解决了

@FrozenByzz 只回退vue版本号就好了撒? 非常感谢

Please reply in English

@radislaw

This a compatibility issue between mint-ui and vue2.4, you can go back to vue2.3.4 to resolve this.

打包就不会报错了

这个组件库已经有好几个月没更新了,那么多issues也不修正。

后悔引入 mint-ui 刚开始接触 vue 用的就是这个,现在看来就是个坑。专注移动端,样式还是 px 最起码考虑到 rem 之类的吧。修修补补 勉强能用,这个bug 到现在没解决,看来自己都放弃了

官方不解决吗。贴个粗暴解决办法
tim 20170729142745
应该是 vue 升级到 2.4.2 后,会检测到当修改 computed 声明的值时候,报出warning。添加 set 方法即可。

Fixed in 2.2.8

我说哥 我都2.2.9版本了 这个问题还没修复

V2.2.13 still has warning

2.2.7 觉得自己很委屈

看了一下代码,v2.2.13之前有一段神奇的代码

    created() {
      this.$on('slotValueChange', this.slotValueChange);
      var slots = this.slots || [];
      var values = [];
      var valueIndexCount = 0;
      slots.forEach(slot => {
        if (!slot.divider) {
          slot.valueIndex = valueIndexCount++;
          values[slot.valueIndex] = (slot.values || [])[slot.defaultIndex || 0];
        }
      });
      this.values = values;
      this.slotValueChange();
    }

看明白了吗?this.values = values;
而明明是一个computed的属性为啥要在这里赋值?
将 mint UI 升级到 2.2.13就没事了。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

acmeid picture acmeid  ·  20Comments

htank-wang picture htank-wang  ·  12Comments

qiansimin88 picture qiansimin88  ·  5Comments

onlySparrow picture onlySparrow  ·  6Comments

714871549 picture 714871549  ·  7Comments