我已经有模板,但是它只是虚拟数据,我想将此模板迁移到vue版本。但是问题出在我的自定义js上,这是我的侧边栏的一部分,必须通过此自定义js进行链接。
我曾尝试将我的自定义js包含在App.vue中,其代码如下:
但是那也不起作用。而且我也在index.html上尝试过它,但是也无法正常工作
<template>
<div id="app" class="wrapper">
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.2.0/css/all.css"
integrity="sha384-hWVjflwFxL6snzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ"
crossorigin="anonymous">
<Sidebar />
<div id="content">
<Navbar />
<router-view/>
</div>
<script src="assets/js/main.js"></script>
</div>
</template>
而且我也曾尝试过类似下面的波纹管
<template>
<div id="app" class="wrapper">
<link rel="stylesheet"
href="https://use.fontawesome.com/releases/v5.2.0/css/all.css"
integrity="sha384-hWVjflwFxL6snzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ"
crossorigin="anonymous">
<Sidebar />
<div id="content">
<Navbar />
<router-view/>
</div>
<script type="text/javascript">
$(".disabled").addClass("disabledbutton");
$(document).ready(function () {
$('#sidebarCollapse').on('click',function () {
$('#sidebar').toggleclass('active');
});
});
</script>
</div>
</template>
很难通过编写来描述它,因为此代码用于使边栏具有交互性。与其他侧边栏一样,能够打开和关闭。