Created
June 15, 2017 21:00
-
-
Save kyoukhana/4ed24fe854300526eae6d82709fe75d3 to your computer and use it in GitHub Desktop.
Route not working in laravel 5.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="{{ app()->getLocale() }}"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<!-- CSRF Token --> | |
<meta name="csrf-token" content="{{ csrf_token() }}"> | |
<title>{{ config('app.name', 'Laravel') }}</title> | |
<!-- Styles --> | |
<link href="{{ asset('css/app.css') }}" rel="stylesheet"> | |
</head> | |
<body> | |
<div id="app"> | |
<router-link to="/">Home</router-link> | |
</div> | |
<!-- Scripts --> | |
<script src="{{ asset('js/app.js') }}"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*Import declarations */ | |
import './Bootstrap'; | |
import VueRouter from 'vue-router'; | |
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 routes = [ | |
{ | |
path: '/', | |
component: (resolve) => { require(['./components/views/home.vue'], resolve)} | |
} | |
] | |
const router= new VueRouter({ | |
routes, | |
hashbang: false, | |
linkActiveClass: 'active', | |
mode: 'history', | |
}) | |
const app = new Vue({ | |
router | |
}).$mount('#app'); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Vue from 'vue'; | |
import VueRouter from 'vue-router'; | |
import axios from 'axios' | |
window.Vue=Vue; | |
window.axios = axios; | |
Vue.use(VueRouter); | |
window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; | |
let token = document.head.querySelector('meta[name="csrf-token"]'); | |
if (token) { | |
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; | |
} else { | |
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div><h1>Test</h1></div> | |
</template> | |
<script> | |
export default{ | |
mounted(){ | |
console.log('HELLO'); | |
} | |
} | |
</script> | |
<style> | |
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VueRouter from 'vue-router'; | |
let routes = [ | |
{ | |
path: '/', | |
component: (resolve) => { require(['./components/views/home.vue'], resolve)} | |
} | |
] | |
export default new VueRouter({ | |
routes, | |
hashbang: false, | |
linkActiveClass: 'active', | |
mode: 'history', | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment