我在父组件中定义了一个事件**@update:isShow="function(){}"**
<template>
<div>
<input type="button" value="我是父组件中的按钮" @click="show">
<child
v-show="isShow"
@update:isShow="function(bol){
isShow = bol;
}"
/>
</div>
</template>
复制代码
现在我想打印一下匿名函数中bol的值,于是我在函数中加了console.log(bol);, 代码变成了下面这样
<template>
<div>
<input type="button" value="我是父组件中的按钮" @click="show">
<child
v-show="isShow"
@update:isShow="function(bol){
console.log(bol);
isShow = bol;
}"
/>
</div>
</template>
复制代码
但是报错了,这是为什么呢?