返回

javascript-将我的Vue视图添加到laravel后没有输出

发布时间:2022-08-26 01:31:11 404
# 前端

我试图连接我的 Vue Games.vue 视图,但无法从这个模板获取我的信息到 laravel 中的模板刀片,我不明白这里有什么问题。

Games.vue

如您所见,我在这里编写代码。

<template>

    <h1>New Vue View</h1>

</template>

<script>

export default {

    mounted() {

        console.log('Component mounted.')

    }

}

</script>

games.blade.php

我调用了 app.js 文件中声明的方法,它应该在这里显示我来自 Games.vue 的信息

@extends('modal')

@section('content')

    <div class="container">

        <h1 class="text-center my-5">Llista de jocs</h1>

        <table class="table table-dark table-bordered">

            <th>Número</th>

            <th>Nom</th>

            <th>Organització</th>

            @auth

                @if(Auth::user()->isAdmin())

                    <th>Opcions

                        <a class="btn btn-success float-lg-end" href="/games/create">Crear Joc</a>

                    </th>

                @endif

            @endauth

            @foreach($games as $game)

                <tr>

                    <td>{{$game->id}}</td>

                    <td>{{$game->name}}</td>

                    <td>{{$game->organization}}</td>

                    @auth

                        @if(Auth::user()->isAdmin())

                            <td>

                                <a class="btn btn-primary" href="/games/edit/{{$game->id}}">Edita</a>

                                <a class="btn btn-danger" href="/games/delete/{{$game->id}}">Elimina</a>

                            </td>

                        @endif

                    @endauth

                </tr>

            @endforeach

        </table>

    </div>

    <div id="app" class="content">

        <games-component></games-component>

    </div>

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

@endsection

app.js

require('./bootstrap');

window.Vue = require('vue');

Vue.component('games-component', require('./components/games/Games.vue'));

const app = new Vue({

    el: '#app'

});

我的输出:https ://i.stack.imgur.com/1ctw3.png

特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报
评论区(0)
按点赞数排序
用户头像