FlowRouter 将 url(路由)前缀附加到所有链接
FlowRouter appending url (route) prefix to all links
最新的 meteor JS 版本破坏了 FlowRouter 或最新的 FlowRouter 版本破坏了 Meteor JS,我找不到导致 Meteor Js 问题的两者之间的那个我想使用 Meteor 开始一个新项目并且 staringatlights:flow-路由器
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 链接来自 public 文件夹。我正在使用模板我不知道 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.
我相信这是因为您的 url 是相对的,因此浏览器采用当前 url 并向其添加 link 路径。
要解决此问题,请添加一个前导斜杠,这样它将解析为相对于域而不是当前页面。例如:
<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>
最新的 meteor JS 版本破坏了 FlowRouter 或最新的 FlowRouter 版本破坏了 Meteor JS,我找不到导致 Meteor Js 问题的两者之间的那个我想使用 Meteor 开始一个新项目并且 staringatlights:flow-路由器
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 链接来自 public 文件夹。我正在使用模板我不知道 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.
我相信这是因为您的 url 是相对的,因此浏览器采用当前 url 并向其添加 link 路径。
要解决此问题,请添加一个前导斜杠,这样它将解析为相对于域而不是当前页面。例如:
<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>