简体   繁体   中英

Inertiajs - Switch to another page locally

I would like to know how to switch between different pages on the client side only, without inertia.visit().

I am using Laravel and Inertiajs.

I understand that props must be specified from the laravel side in order to move to another page.

Is there any way to switch pages without communication between client and server?

I want to switch pages only on the client side with the URL, not by switching components within the same page.

Not sure if you are asking for this, but InertiaJS has an alternative for manual visits - the InertiaJS Link :

<template>
  <Link href="/myPage" v-text="`Click me`" />
</template>

<script setup>
  import { Link } from '@inertiajs/inertia-vue3'
</script>

Logically, anyways you'll have to register a route in routes/web.php , else you'll get a 404:

Route::get('/myPage', function () {
  return inertia('MyPage');
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM