我使用Laravel-Vue SPA 入门项目模板创建了简单的 Laravel 项目,并将该项目上传到 ubuntu 服务器。所有设置正确,但我运行此项目返回此错误“混合清单不存在。(查看:/var/www/html/project/resources/views/index.blade.php)”。
请任何人帮助我。我是 Laravel 的新手。
我正在将 reactjs 与 Laravel (Laravel-mix) 一起使用。我在 storage/app/public/images/slider-girl.png 中有我的图像并引用它
<img src="{require('/images/slider-girl.png')}" />
Run Code Online (Sandbox Code Playgroud)
但不显示图像。
但是,我尝试将图像放在资源和公共文件夹中,但得到了相同的响应。我已经尝试过这里找到的选项,但似乎没有什么对我有用。
<img src={url('storage/app/public/images/slider-girl.png')} />
Run Code Online (Sandbox Code Playgroud)
<img src="{require('/images/slider-girl.png')}" />
Run Code Online (Sandbox Code Playgroud)
我希望显示图像。
好的,我正在使用 laravel 运行两个 React 项目,一个网站和一个管理部分。我希望两个应用程序都呈现在不同的页面上,因为它们的 css 会发生冲突。所以在我的web.php我有这个Route::view('/{path?}', 'app');,但这会将我所有的路线重定向到我的app.blade.php视图。
我只是想知道我是否可以有一条路由使用特定路径名重定向任何路由,比如说:mydomainname.com/admin到我的admin.blade.php. 然后所有其他路线都转到我的app.blade.php.
我的 Laravel 项目没有编译 CSS 文件。我重新安装了 Laravel然后laravel new project,运行npm installnpm run dev.
我得到的结果是:
DONE Compiled successfully in 7112ms
Asset Size Chunks Chunk Names
/js/app.js 1.6 MiB /js/app [emitted] /js/app
Run Code Online (Sandbox Code Playgroud)
列表中缺少 /css/app.css,并且未发出 app.css。
通过运行npm run watch(或 watch-poll/hot),将监视 app.scss 中所做的任何更改,并重新运行构建过程。但是,结果是相同的 - 编译文件列表中没有 app.css,也没有生成 app.css。
我尝试在另一台计算机上创建一个新的 Laravel 项目并npm run dev在其上运行没有问题。两者都运行在 Windows 10 上,节点版本 v10.16.0,npm 版本 6.9.0。
我尝试完全重新安装 Node(到最新的 10.16.0)并从头开始创建一个新的 Laravel 项目,但没有成功。
一旦我改变了一些东西,我想用它npm run watch来重建我的资产。
这对于几乎所有文件都适用,但不适用于我添加到pages目录的文件。如果我npm run watch在更改pages-dir 后再次运行,则正在处理更改。
这是我的树:
\n\n.\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 App.vue\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 components\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Cards\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Video.vue\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 entry-point.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 layouts\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Layout1.vue\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 main.js\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 pages\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 Home\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 View.vue\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 router\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 errors.js\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 home.js\n\xe2\x94\x82\xc2\xa0\xc2\xa0 \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 index.js\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 stores\nRun Code Online (Sandbox Code Playgroud)\n\n这是App.vue:
<template>\n <router-view/>\n</template>\n\n<script>\n export default {\n name: \'app\',\n }\n</script>\nRun Code Online (Sandbox Code Playgroud)\n\n这是main.js
import Vue from \'vue\'\nimport App from \'./App\'\nimport Routes from \'@/js/router/index\'\n\nconst main = new Vue({\n el: \'#app\',\n router: …Run Code Online (Sandbox Code Playgroud) 我有一个 Laravel 和 Vue 项目,在其中我使用importVue 中的动态函数调用将我的组件分成单独的文件。
一切工作正常,但 Vue 块文件(例如,0.js,1.js等)直接放置在public目录下,而public/js不是放置在下app.js。
这是我的 Laravel Mix 文件:
const mix = require('laravel-mix');
mix.js('resources/js/app.js', 'public/js/')
.sass('resources/sass/vendor.scss', 'public/css/')
.sass('resources/sass/app.scss', 'public/css/')
.version();
Run Code Online (Sandbox Code Playgroud)
我需要更改/添加什么才能让 Vue 块文件public/js在每次构建时自动放置在其中,而不是直接放置在public目录下?谢谢。
我正在尝试在 laravel 上安装 vue。我相信我明白了,但是当我运行 npm run watch 或 npm run dev 时,它会生成此错误。我尝试了几件事但无法解决
Error: [VueLoaderPlugin Error] vue-loader 15 currently does not support vue rules with oneOf.
at VueLoaderPlugin.apply (C:\laravel\construtora2\node_modules\vue-loader\lib\plugin-webpack4.js:46:13)
at webpack (C:\laravel\construtora2\node_modules\webpack\lib\webpack.js:51:13)
at processOptions (C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:272:16)
at C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:364:3
at Object.parse (C:\laravel\construtora2\node_modules\webpack-cli\node_modules\yargs\yargs.js:576:18)
at C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:49:8
at Object.<anonymous> (C:\laravel\construtora2\node_modules\webpack-cli\bin\cli.js:366:3)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\laravel\construtora2\node_modules\webpack\bin\webpack.js:156:2)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as …Run Code Online (Sandbox Code Playgroud) 大家好,我在我的 Laravel 项目中启动 Vue 没有什么问题。
这是我的 package.json
"devDependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.32",
"@fortawesome/free-brands-svg-icons": "^5.15.1",
"@fortawesome/free-regular-svg-icons": "^5.15.1",
"@fortawesome/free-solid-svg-icons": "^5.15.1",
"@vue/compiler-sfc": "^3.0.5",
"axios": "^0.21",
"bootstrap": "^4.0.0",
"jquery": "^3.2",
"laravel-mix": "^6.0.0-beta.17",
"laravel-mix-vue3": "^0.7.0",
"lodash": "^4.17.19",
"popper.js": "^1.12",
"postcss": "^8.1.14",
"resolve-url-loader": "^2.3.1",
"sass": "^1.20.1",
"sass-loader": "^8.0.0",
"vue": "^3.0.5",
"vue-loader": "^16.1.2",
"vue-template-compiler": "^2.6.10"
}
Run Code Online (Sandbox Code Playgroud)
网络包组合:
mix.js('resources/js/app.js', 'public/js')
.vue()
.sass('resources/sass/app.scss', 'public/css');
Run Code Online (Sandbox Code Playgroud)
这是我的 app.js
/**
* First we will load all of this project's JavaScript dependencies which
* includes Vue and other libraries. It is a great starting …Run Code Online (Sandbox Code Playgroud) 我正在使用 Laravel Mix,但我遇到了全局变量的问题。
在 app.js 文件中,我有以下内容:
import $ from 'jquery';
window.$ = window.jQuery = $;
var iniciateUserChoiceBool = false;
$(function() {
require('./functions');
require('./tabs');
});
Run Code Online (Sandbox Code Playgroud)
我在functions.js 和tabs.js 中使用的相关变量iniciateUserChoiceBool,我需要它是相同的变量。但每次我得到:
Uncaught ReferenceError: iniciateUserChoiceBool is not defined
Run Code Online (Sandbox Code Playgroud)
如果我将变量放在functions.js 和tabs.js 中的不同文件中,错误就会消失,但功能会发生变化,因为变量不相同且语句if不同。如何在 Laravel mix 中使用全局变量?
我也这样测试过,还是报错。
import $ from 'jquery';
window.$ = window.jQuery = $;
$(function() {
var iniciateUserChoiceBool = false;
require('./functions');
require('./tabs');
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用以下堆栈设置一个新的 Laravel 8 项目,Laravel 8 + Inertia.js + Vue.js 3 + Typescript(和 TailwindCSS,但尚未设置)。
由于某种原因,我在传递给 app.ts 文件中的 setup 函数的“App”变量上遇到了一个奇怪的错误,它由 VSCode 突出显示,当我将其悬停时,它会显示
Property 'App' does not exist on type '{ el: Element; app: InertiaApp; props: InertiaAppProps; plugin: Plugin_2; }'.ts(2339)
Run Code Online (Sandbox Code Playgroud)
和往常一样,这肯定是一些愚蠢的事情,但我就是不明白那是什么。
我正在关注本教程https://laravel-news.com/typescript-laravel和 Inertia.js 文档https://inertiajs.com/client-side-setup
我很感激任何帮助,谢谢。
------------------------------ resources/js/app.ts
import { createApp, h } from 'vue'
import { createInertiaApp } from '@inertiajs/inertia-vue3'
createInertiaApp({
resolve: name => require(`./Pages/${name}`),
setup({ el, App, props, plugin }) {
createApp({ render: () => h(App, props) })
.use(plugin) …Run Code Online (Sandbox Code Playgroud) laravel-mix ×10
laravel ×9
vue.js ×5
webpack ×4
php ×2
reactjs ×2
inertiajs ×1
javascript ×1
laravel-vue ×1
sass ×1
typescript ×1
vuejs2 ×1
vuejs3 ×1
vuetify.js ×1
vuex ×1