源码
<template>
<div class="hello ">
<img :src="img1" alt="" :title="tit" v-show="flag">
<button type="button" @click="_click()">隐藏显示图片</button>
</div>
</template>
<script>
export default {
name: 'HelloWorld',
props: {
msg: String
},
data() {
return {
img1: require('../assets/logo.png'),
flag: true,
},
},
methods: {
_click() {
this.flag = !this.flag
},
},
}
</script>
运行结果