Vuejs2 在vue应用程序中设置“正常工作”菜单
我想使用SB管理员2模板从 在我的Laravel 5.7/Vuejs 2.6/Vuex 3.1/Bootstrap 4.3应用程序中,我采取了一些步骤: 由于它基于控制台中的metismenu,因此我运行以下命令:Vuejs2 在vue应用程序中设置“正常工作”菜单,vuejs2,metismenu,Vuejs2,Metismenu,我想使用SB管理员2模板从 在我的Laravel 5.7/Vuejs 2.6/Vuex 3.1/Bootstrap 4.3应用程序中,我采取了一些步骤: 由于它基于控制台中的metismenu,因此我运行以下命令: npm install --save metismenu npm i popper npm audit fix 在参考资料/js/app.js中,我包含了metismenu: require('./bootstrap'); //require('popper'); /* If
npm install --save metismenu
npm i popper
npm audit fix
在参考资料/js/app.js中,我包含了metismenu:
require('./bootstrap');
//require('popper');
/* If to uncomment line above in console I got lot of errors :
WARNING in ./node_modules/popper/index.js 235:35-58
Critical dependency: the request of a dependency is an expression
@ ./resources/js/app.js
@ multi ./resources/js/app.js ./resources/sass/sb2/app.scss ./resources/sass/sb2/sb-admin-2.scss
*/
require('metismenu');
require('jquery');
window.Vue = require('vue');
...
在resources/js/helpers/commonFuncs.js中,该文件用于所有vue页面I init菜单中的方法:
export function checkAuthorization(store, router) {
// console.log("-11 checkAuthorization::")
router.beforeEach((to, from, next) => {
jQueryInit();
next();
...
function jQueryInit() {
// alert( "jQueryInit"+(-55) )
$(function () {
// alert( "INSIDE::"+var_dump(-11) )
$('#side-menu').metisMenu();
console.log("Inside $('#side-menu')::")
console.log($('#side-menu'))
});
//Loads the correct sidebar on window load,
//collapses the sidebar on window resize.
// Sets the min-height of #page-wrapper to window size
$(function () {
var setupPage = function () {
var topOffset = 50;
console.log("++1 typeof window::")
console.log(typeof window)
console.log(window)
var width = (window.innerWidth > 0) ? window.innerWidth : screen.width;
if (width < 768) {
$('div.navbar-collapse').removeClass('show');
topOffset = 100; // 2-row-menu
} else {
$('div.navbar-collapse').addClass('show');
}
console.log("++2 typeof window::")
console.log(typeof window)
console.log(window)
var height = ((window.innerHeight > 0) ? window.innerHeight : screen.height) - 1;
height = height - topOffset;
if (height < 1) height = 1;
if (height > topOffset) {
$("#page-wrapper").css("min-height", (height) + "px");
}
};
// debugger
$(window).bind("load resize", setupPage);
var url = window.location;
var element = $('ul.nav a').filter(function () {
return this.href == url;
}).addClass('active').parent();
while (true) {
if (element.is('li')) {
element = element.parent().addClass('in').parent();
} else {
break;
}
}
setupPage();
});
alert( "AFTER jQueryInit"+(-55) )
}
成功了
但我的页面布局被破坏了。
你可以在现场观看
请注意控制台输出:
我添加了样式定义:
#wrapper {
width: 100%;
background-color: yellow;
border: 2px dotted red;
}
确保应用了resources/sass/sb2/sb-admin-2.scss中的样式。
有什么问题吗?是否可以在vue应用程序metismen.js中工作
谢谢 抱歉,我仍在搜索decision,知道为什么我无法在vuejs应用程序中正确运行MetisMenu吗?谁这样做的?MetisMenu非常受欢迎…抱歉,我仍在搜索decision,知道为什么我无法在vuejs应用程序中正确运行MetisMenu吗?谁这样做的?MetisMenus很受欢迎。。。
#wrapper {
width: 100%;
background-color: yellow;
border: 2px dotted red;
}