最新流星JS版本打破FlowRouter或最新的FlowRouter版本打破Meteor JS,我找不到导致问题的2之间的Meteor Js我想用Meteor和staringatlights启动一个新项目:flow-router
staringatlights:flow-router
kadira:blaze-layout
我有这样设置FlowRouter:
var public = FlowRouter.group();
public.route('/', {
name: 'home', action(){
BlazeLayout.render('MainLayout', {main: 'home'});
}
});
var authusers = FlowRouter.group({
prefix: '/private',
name: 'authusers'
});
authusers.route('/dashboard', {
name: 'dashboard', action(){
BlazeLayout.render('DashboardLayout', {dashboards: 'dashboard'});
}
});
我有其他模板的布局。 CSS和JS链接来自公用文件夹。我正在使用模板我不知道为什么FlowRouter将路由的前缀附加到所有这些链接。
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>OL' Tega</title>
<link rel="stylesheet" href="themes/adminlte3/plugins/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="themes/adminlte3/dist/css/adminlte.min.css">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700" rel="stylesheet">
</head>
<template name="DashboardLayout">
{{> Template.dynamic template=dashboards}}
<script src="themes/adminlte3/plugins/jquery/jquery.min.js"></script>
<script src="themes/adminlte3/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="themes/adminlte3/dist/js/adminlte.js"></script>
<script src="themes/adminlte3/dist/js/demo.js"></script>
<script src="themes/adminlte3/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="themes/adminlte3/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="themes/adminlte3/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="themes/adminlte3/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="themes/adminlte3/plugins/chartjs-old/Chart.min.js"></script>
<script src="themes/adminlte3/dist/js/pages/dashboard2.js"></script>
</template>
这是我得到的错误。它不是。路由器将路由前缀附加到所有链路。
Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/plugins/font-awesome/css/font-awesome.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
dashboard:1 Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/dist/css/adminlte.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
10Refused to execute script from '<URL>' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/jquery/jquery.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/bootstrap/js/bootstrap.bundle.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/dist/js/adminlte.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/dist/js/demo.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/sparkline/jquery.sparkline.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-world-mill-en.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/slimScroll/jquery.slimscroll.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/plugins/chartjs-old/Chart.min.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to execute script from 'http://localhost:3000/private/themes/adminlte3/dist/js/pages/dashboard2.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
dashboard:1 Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/plugins/font-awesome/css/font-awesome.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
dashboard:1 Refused to apply style from 'http://localhost:3000/private/themes/adminlte3/dist/css/adminlte.min.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
答案 0 :(得分:1)
我认为这是因为您的网址是相对的,因此浏览器会获取当前网址并添加链接路径。
要解决此问题,请使用添加前导斜杠,以便它将相对于域而不是当前页面进行解析。例如:
<script src="/themes/adminlte3/plugins/jquery/jquery.min.js"></script>
<script src="/themes/adminlte3/plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="/themes/adminlte3/dist/js/adminlte.js"></script>
<script src="/themes/adminlte3/dist/js/demo.js"></script>
<script src="/themes/adminlte3/plugins/sparkline/jquery.sparkline.min.js"></script>
<script src="/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
<script src="/themes/adminlte3/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
<script src="/themes/adminlte3/plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="/themes/adminlte3/plugins/chartjs-old/Chart.min.js"></script>
<script src="/themes/adminlte3/dist/js/pages/dashboard2.js"></script>