当前位置: 首页 > 知识库问答 >
问题:

laravel添加引导javascript文件不工作

卢恩
2023-03-14

我有一个Laravel项目,我试图添加bootstrap.bundle.min.js和bootstrap.min.js文件到我的header.blade.php文件,但我似乎得到以下错误在控制台:

解释为样式表但使用MIME类型应用程序/javascript传输的资源:http://localhost:8000/css/bootstrap/js/bootstrap.bundle.min.js".

资源解释为样式表,但传输与MIME类型的应用程序/javascript:"http://localhost:8000/css/bootstrap/js/bootstrap.min.js".

Bootstrap似乎确实在工作,但它附带的Javascript文件却不起作用。

PHP文件夹

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>Album example for Bootstrap</title>


<script src="/css/bootstrap/js/jquery-3.4.1.min.js"></script>

<link href="/css/bootstrap/js/bootstrap.bundle.min.js" rel="stylesheet">
<link href="/css/bootstrap/js/bootstrap.min.js" rel="stylesheet">

<link href="/css/bootstrap/css/bootstrap.min.css" rel="stylesheet">

<link href="/css/main.css" rel="stylesheet">
<link href="/css/media.css" rel="stylesheet">

PACKAGE.JSON

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "mix",
        "watch": "mix watch",
        "watch-poll": "mix watch -- --watch-options-poll=1000",
        "hot": "mix watch --hot",
        "prod": "npm run production",
        "production": "mix --production"
    },
    "devDependencies": {
        "@tailwindcss/forms": "^0.2.1",
        "@tailwindcss/typography": "^0.3.0",
        "alpinejs": "^2.7.3",
        "axios": "^0.21",
        "laravel-mix": "^6.0.16",
        "lodash": "^4.17.19",
        "postcss": "^8.1.14",
        "postcss-import": "^12.0.1",
        "resolve-url-loader": "^3.1.2",
        "sass": "^1.32.8",
        "sass-loader": "^11.0.1",
        "tailwindcss": "^2.0.1",
        "webpack-cli": "^4.6.0"
    },
    "name": "epood6",
    "description": "<p align=\"center\"><a href=\"https://laravel.com\" target=\"_blank\"><img src=\"https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg\" width=\"400\"></a></p>",
    "version": "1.0.0",
    "main": "webpack.mix.js",
    "directories": {
        "test": "tests"
    },
    "dependencies": [],
    "keywords": [],
    "author": "",
    "license": "ISC"
}

共有2个答案

柴丰
2023-03-14

所有脚本文件都应与脚本标记链接。

<script src="/js/jquery-3.4.1.min.js"></script>
<script src="/bootstrap/js/bootstrap.bundle.min.js">
<script src="/bootstrap/js/bootstrap.min.js">

请确保脚本的文件路径正确。

陶宏浚
2023-03-14
<link href="/css/bootstrap/js/bootstrap.min.js" rel="stylesheet">

.js文件不是

 类似资料:
  • 大家好,我已经为我的应用程序安装了引导程序,它并不工作。这是我的application.scss档案 这是我的申请表。rb文件: application.js文件: 最后是我的Gem文件: 以下是我在尝试向网页添加导航栏时得到的信息:

  • 在eclipse中,我会编写代码,最后,我会执行CTRL-SHIFT-O,所有导入都会被添加和重新组织,等等。 我已经看到了做CTRL ALT O的所有其他答案(我把它改回eclipse keymap),我已经做了所有可能的设置。IntelliJ不会添加任何新的导入,我必须手动转到损坏的导入,然后按ALT ENTER,然后鼠标移到导入类,为每个新类。有时候,这种情况不会发生,intelliJ实际上

  • 我遵循这里描述的方法:https://github.com/jeroenbellen/blog-manage-and-reload-spring-properties,唯一的区别是,在我的例子中,属性在多个类中使用,所以我将它们放在一个实用工具类中,并使用getter引用它的变量。这就是类的样子: 我在其他类中使用变量,比如。我能够加载的属性启动只是很好,但我不能动态更新他们在飞行。有人能说出我做

  • 我正在使用react、redux和next.js创建一个项目,并希望在js中导入CSS文件。 我遵循了next.js/#css和next css中的说明,但发现css样式不起作用。 我的代码如下: pages/index.js: next.config.js: style.css: package.json: 问题: 1.Chrome中有一个“未捕获的语法错误”,但它似乎不会影响页面的呈现。但我仍

  • 我想创建一个包含xml文件的zip文件夹并下载它。我可以下载zip,但它是空的。 我可以创建xml和zip: 顺便说一下,$result是ArrayToXML::CONVERT(array,....) 如何将xml文件添加到ZIP。我刚来拉拉维尔请帮帮我