Vue components not showing with passport in laravel 5.3

Hi, I am trying a passport in laravel 5.3 using the following link https://laravel.com/docs/5.3/passport

in app.js

/**
 * First we will load all of this project JavaScript dependencies which
 * include Vue and Vue Resource. This gives a great starting point for
 * building robust, powerful web applications using Vue and Laravel.
 */

require('./bootstrap');

/**
 * Next, we will create a fresh Vue application instance and attach it to
 * the body of the page. From here, you may begin adding components to
 * the application, or feel free to tweak this setup for your needs.
 */

Vue.component('example', require('./components/Example.vue'));

Vue.component(
    'passport-clients',
    require('./components/passport/Clients.vue')
);

Vue.component(
    'passport-authorized-clients',
    require('./components/passport/AuthorizedClients.vue')
);

Vue.component(
    'passport-personal-access-tokens',
    require('./components/passport/PersonalAccessTokens.vue')
);


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

in my view file

@extends('layouts.app')

@section('content')

<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <passport-clients></passport-clients>
            <passport-authorized-clients></passport-authorized-clients>
            <passport-personal-access-tokens></passport-personal-access-tokens>
        </div>
    </div>
</div>
@endsection

I was tired of updating node to 6.4.0 also on 6.7.0, but noted that it worked for me also changed the gulp file

const elixir = require('laravel-elixir');

require('laravel-elixir-vue');

/*
 |--------------------------------------------------------------------------
 | Elixir Asset Management
 |--------------------------------------------------------------------------
 |
 | Elixir provides a clean, fluent API for defining some basic Gulp tasks
 | for your Laravel application. By default, we are compiling the Sass
 | file for our application, as well as publishing vendor resources.
 |
 */
elixir(function (mix){
    mix.sass('app.scss')
       .webpack('app.js');
});

but templates do not appear in my views, even in the added source code, including

+4
source share
1 answer

Make sure you include the js file in layouts.app

@yield('content')
</div>

<!-- Scripts -->
**<script src="/js/app.js"></script>**
</body>
</html>

and in your app.js application change body to #app

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

I ran into the same problem and it worked for me.

0
source

Source: https://habr.com/ru/post/1657038/


All Articles