我想在我的項目中使用Laravel護照,我遵循Laravel護照https://laravel.com/docs/5.3/passport的本教程。要求未在app.js中爲laravel護照定義
繼本教程後,我得到Uncaught ReferenceError:require is not defined error。
請看看到我的文件:
gulpfile.js
var elixir = require('laravel-elixir'); require('laravel-elixir-webpack'); elixir(function(mix) { mix.scripts('app.js'); mix.styles([ 'bootstrap.min.css', 'font-awesome.min.css', 'gentelella.min.css' ],'public/css/app.css'); });
資源/資產/ JS/app.js
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: '#manage-passport' });
home.blade .php
@extends('layouts.blank') @section('content') <div class="container" id="manage-passport"> <!-- let people make clients --> <passport-clients></passport-clients> <!-- list of clients people have authorized to access our account --> <passport-authorized-clients></passport-authorized-clients> <!-- make it simple to generate a token right in the UI to play with --> <passport-personal-access-tokens></passport-personal-access-tokens> </div> @stop
blank.blade.php
<head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Meta, title, CSS, favicons, etc. --> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Passport! | </title> <meta name="token" id="token" value="{{ csrf_token() }}"> <!-- Styles --> <link href="/css/app.css" rel="stylesheet"> </head> <body class="nav-md"> <div class="container body"> <div class="main_container"> @yield('content') </div> </div> <script src="/js/jquery.min.js"></script> <script src="/js/bootstrap.min.js"></script> <script src="js/gentelella.min.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script> <link href="//cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/css/toastr.min.css" rel="stylesheet"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/vue-resource/1.0.3/vue-resource.min.js"></script> <script type="text/javascript" src="/js/app.js"></script> @stack('scripts') </body>
沒有ü更改後吞掉? –
是的,但它顯示我的錯誤。 –
你是怎麼吞下去的?好像你沒有吞嚥,否則你不會得到那個錯誤。 –