v-show able to hide but not show
ringa_lee
ringa_lee 2017-05-16 13:36:49
0
7
700

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>
ringa_lee
ringa_lee

ringa_lee

reply all(7)
小葫芦

You remove display:none from the style. . . . v-show itself can be set to show and hide.

淡淡烟草味

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;
滿天的星座

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.

漂亮男人

When set to true, it does not need to be display:block and it can also be displayed

滿天的星座

See the source code

迷茫

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
            }
        },
左手右手慢动作

display是根据你的便签属性来的,如果是块级元素如p,p,h标签,默认的就是display: block;如果是span等默认就是display:inline。所以隐藏的时候就是display:none,显示的时候去掉display:noneis its default attribute

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template