Русское сообщество разработки на PHP-фреймворке Laravel.
Ты не вошёл. Вход тут.
Страницы 1
Привет. Собственно сабж.
app.js
require('./bootstrap')
import { createApp } from 'vue'
import {createRouter, createWebHistory} from 'vue-router'
//import Main from './Main'
import { routes } from './routes';
const history = createWebHistory({});
const router = createRouter({
base: '/',
history:history,
routes
});
const app = createApp({
el: '#app',
router
});
routes.js
import UserComponent from './components/UserComponent.vue';
import CreateComponent from './components/CreateComponent.vue';
import EditComponent from './components/EditComponent.vue';
export const routes = [
{
name: 'users',
path: '/',
component: UserComponent
},
{
name: 'create',
path: '/create',
component: CreateComponent
},
{
name: 'edit',
path: '/edit/:id',
component: EditComponent
}
];
App.vue
<template>
<div class="container">
<div class="text-center m-5">
<span class="lead">Laravel 8 CRUD Operation using Vue.js</span>
</div>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="collapse navbar-collapse">
<div class="navbar-nav">
<router-link to="/" class="btn btn-primary m-1 nav-link">Users</router-link>
<router-link to="/create" class="btn btn-success m-1 nav-link">Add User</router-link>
</div>
</div>
</nav>
<router-view></router-view>
</div>
</template>
<script>
export default {}
</script>
В итоге
http://lvue/[objectObject]
Не в сети
Разобрался.
Не в сети
Страницы 1