• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Catatan Vue Laravel Example

Kepala Suku

Web & Mobile Developer
Staff member
#1
Kodingan app.js
JavaScript:
require('./bootstrap');
window.Vue = require('vue');
import VueRouter from 'vue-router';
import VueAxios from 'vue-axios';
import axios from 'axios';
import App from './components/App.vue';
import VueSweetalert2 from 'vue-sweetalert2';
import 'sweetalert2/dist/sweetalert2.min.css';
import Vue from 'vue'
import { BootstrapVue, IconsPlugin } from 'bootstrap-vue'

import * as VueGoogleMaps from 'vue2-google-maps'

Vue.use(VueGoogleMaps, {
    load: {
        key: 'AIzaSyBbS-TmQ197oGCU99s4nN8Vx0YDjmaSCtE',
        libraries: 'places',
    },
    installComponents: true
})

// Install BootstrapVue
Vue.use(BootstrapVue)
// Optionally install the BootstrapVue icon components plugin
Vue.use(IconsPlugin)
window.axios.defaults.baseURL = document.head.querySelector('meta[name="base-url"]').content;

Vue.use(VueRouter);
Vue.use(VueSweetalert2);
Vue.use(VueAxios, axios);

import {routes} from './routes'; //ubah lah

Vue.use(VueRouter);
Vue.use(VueAxios, axios);

const router = new VueRouter({
    mode: 'history',
    routes: routes
});

const app = new Vue({
    el: '#app',
    router: router,
    render: h => h(App),
});
Kodingan route.js
JavaScript:
import AllManifest from './components/ManifestIndex.vue';
import ManifestAdd from './components/ManifestAdd.vue';
import ManifestDetail from './components/ManifestDetail.vue';

export const routes = [
    {
        name: 'home',
        path: '/',
        component: AllManifest
    },
    {
        name: 'add',
        path: '/add',
        component: ManifestAdd
    },
    {
        name: 'mDetail',
        path: '/manifest/detail',
        component: ManifestDetail
    }
];