自定义vue组件中的vuejs v-show调用TypeError:无法读取未定义的属性'_withTask'

时间:2019-04-19 05:05:00

标签: vue.js typeerror

我制作了以下自定义Vue组件“ editable-image”。

<template>
  <span style="position: relative; text-align: center; color: white; cursor: pointer; margin-right: 10px;" @mouseover="iconShown = true" @mouseleave="iconShown = false" @click="click">
    <img :style="`width: ${width};`" :src="imageUrl"/>
    <v-icon style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);" large color="grey" v-show="iconShown">edit</v-icon>
  </span>
</template>

<script>
export default {
props: ['imageUrl', 'width', 'click'],
data() {
    return {
        iconShown: false
    }
}
}
</script>

然后,在我的主要组件中,导入上面的“可编辑图像”,然后将鼠标悬停在 TypeError:无法读取未定义的属性'_withTask'

我注意到 v-show是问题的主要原因,但是尽管进行了很多尝试,但仍未解决。

1 个答案:

答案 0 :(得分:0)

已解决

问题是点击道具。

在主要组件中,我应该正确输入了点击道具