Vue updated dynamically, but dom did not render successfully

data: {
    percentge: ""
},
watch:{
        percentage: function (curVal, oldVal) {
            this.changePercent(curVal)
        }
    },
methods: {
        changePercent: function (curVal) {
            this.$nextTick(() => {
                this.percentage = curVal
            }
        },

clipboard.png

as shown in the figure, I am listening for a percentage, and then I have such a button in dom. If the percentage is 10, the button will be displayed, but although the percentage is 10, the properties of the button still do not take effect. I feel that the percentage of dom has not been updated

.

disabled is a Boolean value. You write the strings "true" and "false"


disabled: this.percentge === '10' ? true : false

.

look at the current code guess, there are several possible problems:

  • Misspelling of percentge attribute in data
  • look at i-button is written in iview. The diabled attribute should be passed in as the props of the component to control the button to enable or disable
  • .
  • disabled to set a Boolean value, use disabled: this.percentge = '10' directly

disabled is a Boolean value

disabled: this.percentge === '10'
Menu