Mr. Perfectionist
Mr. Perfectionist

Reputation: 2746

Route parameter passing error : Laravel+Vue

I am using Laravel 5.7 and Vue.js 2.

I want to test Vue.js route parameters. But it is not working!!

app.js:

import ProductDetails from './components/front/shop/ProductDetails'

const routes = [
{
    path: '/pds/:id',
    component: ProductDetails
}

ProductDetails.vue

<template>
    <h1>Book {{ $route.params.id }} </h1>
</template>

When I started testing in localhost:8000/pds/1 Page not Found is coming. reasons needed for this error.

Upvotes: 0

Views: 300

Answers (1)

Alex
Alex

Reputation: 1423

You must configure your backend. See here

<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/{any}', 'SpaController@index')->where('any', '.*');

Upvotes: 1

Related Questions