Javascript 当我单击侧边栏按钮时,切换不会发生,因为我使用的输入类型是复选框,并通过使用标签连接到菜单图标

Javascript 当我单击侧边栏按钮时,切换不会发生,因为我使用的输入类型是复选框,并通过使用标签连接到菜单图标,javascript,html,css,vue.js,sass,Javascript,Html,Css,Vue.js,Sass,“当我单击复选框时,如果我添加一些属性,侧边栏将隐藏(显示:复选框为无)现在侧边栏隐藏不起作用。在这里,我使用标签概念连接侧边栏。如果我删除显示:无复选框可见,当我选中复选框时,隐藏侧边栏起作用。请帮助我解决此问题“ Dashboard.vue <template> <div class="dashboard"> <input type="checkbox" id="check"> &

“当我单击复选框时,如果我添加一些属性,侧边栏将隐藏(显示:复选框为无)现在侧边栏隐藏不起作用。在这里,我使用标签概念连接侧边栏。如果我删除显示:无复选框可见,当我选中复选框时,隐藏侧边栏起作用。请帮助我解决此问题“
Dashboard.vue

<template>
<div class="dashboard">
    <input type="checkbox" id="check">
    <header>
        <label for="check">
            <i id="sidebar_btn"  class="fas fa-bars"></i>
        </label>

        <div class="left_area">
            <h3><img style="height:35px;" src="../assets/keep.jpg" alt="not" />Fund<span>oo</span></h3>
        </div>

        <div class="input-group">
            <div class="form-outline">
                <input type="search" id="form1" class="form-control" placeholder='search...' />
            </div>
        </div>

        <div class="right-area">

            <i style="font-size:25px;" id="pic" class="fas fa-user-circle"></i>
        </div>

        <hr>
    </header>

    <div class="sidebar" id="A">
        <a href=""><i class="fas fa-lightbulb"></i><span>Notes</span></a>
        <a href=""><i class="fas fa-bell"></i><span>Reminders</span></a>
        <a href=""><i class="fas fa-pen-square"></i><span>Edit-labels</span></a>
        <a href=""><i class="fas fa-archive"></i><span>Archive</span></a>
        <a href=""><i class="fas fa-trash-alt"></i><span>Trash</span></a>
    </div>
    <CreateNote/>
</div>
</template>

<script>

import CreateNote from './CreateNote.vue'
export default {
      components: {
          CreateNote
    },
    data() {
    },
    methods: {
        toggleMenu(e) {
            e.classList.toggle("active");
            document.querySelector("sidebar").classList.toggle("active");
        },
      
    }
}
</script>

<style scoped lang="scss">
@import "@/styles/components/Dashboard.scss";
</style> 
/* #sidebar_btn.active{
    left:0;
} */
/* #check{
    display:none;
}  */
body {
    margin: 0;
    padding: 0;
    font-family: sans-serif;
}
header {
    position: fixed;
    background: white;
    padding: 20px;
    width: 100%;
    height: 70px;
}
input[type="search"] {
    width: 700px;
    height: 70px;
    height: 25px;
    background-color: rgb(231, 229, 229);
    margin-top: -2%;      /* search-bar moved top*/
}
.left_area {
    h3 {
        color: black;
        margin-top: -20px;
        margin-left: 5%;
        text-transform: uppercase;
        font-size: 22px;
        font-weight: 900;
    }
    span {
        color: #1DC4E7;
    }
}
#pic {
    margin-top: -32px;
    float: right;
    color: black;
}
.logout_btn {
    padding: 0px;
    text-decoration: none;
    float: right;
    margin-top: -32px;
    margin-right: 40px;
    border-radius: 2px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    transition: 0.5s;
    transition-property: background;
    &:hover {
        background: #0D9D6B;
    }
}
.input-group {
    .form-outline {
        margin-top: -32px;
        margin-left: 30%;
        width: 400px;
    }
}
.sidebar {
    background: whiteb;
    margin-top: 70px;
    padding-top: 30px;
    position: fixed;
    left: 0;
    width: 250px;
    height: 100%;
    transition: 0.5s;
    transition-property: left;
    a {
        color: black;
        display: block;
        width: 100%;
        line-height: 60px;
        text-decoration: none;
        padding-left: 40px;
        box-sizing: border-box;
        transition: 0.5s;
        transition-property: background;
        &:hover {
            background: lightpink;
            border-radius: 0px 30px 30px 0px;
        }
    }
    i {
        padding-right: 10px;
    }
}
label {
    #sidebar_btn {
        z-index: 1;
        color: black;
        position: fixed;
        cursor: pointer;
        left: 300px;
        font-size: 20px;
        margin: 25px 0;
        margin-left: -17%;
        transition: 0.5s;
        transition-property: color;
        &:hover {
            color: white;
        }
    }
}
#form1 {
    height: 35px;
}
#check {
    &:checked {
        ~ {
            .sidebar {
                left: -190px;
                a {
                    span {
                        display: none;
                    }
                    font-size: 20px;
                    margin-left: 170px;
                    width: 80px;
                }
            }
        }
    }
}
#list {
    margin-top: -25px;
    font-size: 25px;
    float: right;
    color: grey;
    margin-left: 28%;
}