search

Home  >  Q&A  >  body text

javascript - vue component binding computed method return value, binding exception occurs?

As shown in the picture, add the code

Component p.star is bound to the value returned by the calculated attribute method

This is a computed property

Finally a binding exception broke out

某草草某草草2709 days ago904

reply all(3)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-06-26 10:56:52

    props: {
        size: {
            type: Number
        },
        score: {
            type: Number
        }
    },
    
    computed: {
        starType() {
            return "star-" + this.size;
        }
    }

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-26 10:56:52

    :class="starType" 改成 v-model="starType"

    reply
    0
  • 女神的闺蜜爱上我

    女神的闺蜜爱上我2017-06-26 10:56:52

    computed seems to be written in props, so the error is reported

    reply
    0
  • Cancelreply