Trying the v-show attribute, when set to false, the inline style display: none,
But when true is set, display: block will not be added;
Solve. . .
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
p {
width: 400px;
height: 400px;
border: 1px solid #000;
display: none;
}
</style>
</head>
<body>
<p id="vue" v-show="true"></p>
<script type="text/javascript" src="vue.js"></script>
<script>
new Vue({
el: "#vue",
})
</script>
</body>
</html>
高洛峰2017-05-16 13:38:49
You remove display:none from the style. . . . v-show itself can be set to show and hide.
淡淡烟草味2017-05-16 13:38:49
Because it’s in your css code
display:none
v-show will only be added when hide
display:none;
It will be removed when displayed
display:none;
Will not be added
display:block;
滿天的星座2017-05-16 13:38:49
The principle of v-show is to control the display and hide by adding display: none, which is different from the traditional hide and show of jquery.
漂亮男人2017-05-16 13:38:49
When set to true, it does not need to be display:block and it can also be displayed
迷茫2017-05-16 13:38:49
You are asking a question
v-show is originally used to control the display and hiding.
Just give it a value to control the display and hiding.
<ul v-show="show">
<li @click="change($event)">哈哈哈</li>
<li @click="change($event)">啦啦啦</li>
<li @click="change($event)">嘻嘻嘻</li>
</ul>
data(){
return{
items:['1111','2222','3333'],
show:true
}
},
ringa_lee2017-05-16 13:38:49
display
是根据你的便签属性来的,如果是块级元素如p,p,h
标签,默认的就是display: block;
如果是span
等默认就是display:inline
。所以隐藏的时候就是display:none,显示的时候去掉display:none
is its default attribute