admin管理员组

文章数量:1389758

I am trying to setup VueJs using laravel 5.7 and mix and it just says VueJs not detected. I have run npm install. Here is my wele view:

<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <link rel="stylesheet" href=".7.2/css/bulma.css">

        <style type="text/css">body { padding-top: 40px; }</style>
    </head>
    <body>
        <div id="root" class="container">
            <message title="Hello World" body="Lorem ipsum dolor sit amet."></message>
    </div>
    </body>
</html>

here is my app js:

require('./bootstrap');

window.Vue = require('vue');

Vueponent('message', require('./ponents/Message.vue'));

const app = new Vue({
    el: '#root'
});

I can't figure out why VueJs won't work. Any help would be greatly appreciated. Thank you!

I am trying to setup VueJs using laravel 5.7 and mix and it just says VueJs not detected. I have run npm install. Here is my wele view:

<!doctype html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <title>Laravel</title>

        <link rel="stylesheet" href="https://cdnjs.cloudflare./ajax/libs/bulma/0.7.2/css/bulma.css">

        <style type="text/css">body { padding-top: 40px; }</style>
    </head>
    <body>
        <div id="root" class="container">
            <message title="Hello World" body="Lorem ipsum dolor sit amet."></message>
    </div>
    </body>
</html>

here is my app js:

require('./bootstrap');

window.Vue = require('vue');

Vue.ponent('message', require('./ponents/Message.vue'));

const app = new Vue({
    el: '#root'
});

I can't figure out why VueJs won't work. Any help would be greatly appreciated. Thank you!

Share Improve this question asked Oct 17, 2018 at 15:54 L. FoxL. Fox 3541 gold badge7 silver badges20 bronze badges 2
  • You don't have any script tag in your view.. – Devon Bessemer Commented Oct 17, 2018 at 16:04
  • ah ok thank you! the simplest things! – L. Fox Commented Oct 17, 2018 at 16:06
Add a ment  | 

3 Answers 3

Reset to default 5

As said, you missed the script tag.

If you are piling your sources you should use mix() rather than asset(), as it will respect things such as file versioning with mix.version().

e.g.

<script src="{{ mix('/js/app.js') }}"></script>

you need to add this script in your index.blade.php

<script src="{{ asset('/js/app.js') }}"></script>

thanks , this make the magic

<script src="{{ mix('/js/app.js') }}"></script>

in laravel I place it inside the blade HTML and then reload the page , F12 and there was the vue tab working and now I can see the tags of vue.

本文标签: javascriptVueJs not detected in Laravel using MixStack Overflow