vue.runtime.esm.js?2b0e:619 [Vue warn]: Avoid mutating a prop directly since the value will be overwritten whenever the parent component re-renders. Instead, use a data or computed property based on the prop’s value. Prop being mutated: “activeName”

export default {
  name : 'MoviesTop',
  props: {
    recentTags: Array,
    activeName: String
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab,event)
    }
  }
}

改为

export default {
  name : 'MoviesTop',
  props: {
    recentTags: Array,
    categroy: String
  },
  data() {
    return {
      activeName: this.categroy
    }
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab,event)
      this.$emit("queryCoures", this.activeName);
    }
  }
}

问题解决

Logo

前往低代码交流专区

更多推荐