<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>head</title>
</head>
<script src="vue.min.js"></script>
<body>
<div id="app">
<button @click="toggle">显示和隐藏数据</button><br>
<span v-show="isshow">hello</span>
</div>
</body>
<script>
new Vue({
el:'#app',
data:{
return {
isshow:false
};
},
methods:
{
toggle:function () {
this.isshow=!this.isshow;//对它进行取反
}
}
});
</script>
</html>
网友评论