Giter Site home page Giter Site logo

ionic5-vue3-ts-example's Introduction

This Project is an minimal reproduction for some Ionic Framework error

Ionic Vue 5 + Vue3 + Typescript Project

Dependencies:

"@ionic/vue": "5.9.4",
"@ionic/vue-router": "5.9.4",
"@ionic/core": "5.9.4",
"vue": "^3.2.21",
"vue-router": "4.1.3",

minimal reproduction: https://github.com/peixin/ionic5-vue3-ts-example

preview: https://ionic5-vue3-ts-example.vercel.app

Error:

Intercept the route in onBeforeRouteLeave hook and replace to another route. The path has changed, but the component has not refreshed.(Only trigger developer service hot reload, the page can be rendered.)

Steps to Reproduce

/courses -> /course/1/navigation --> /course/1/information --> [back] [intercept]

Expected Behavior

/courses -> /course/1/navigation --> /course/1/information --> [back] [intercept]
                                 --> /course/1/leave

Current Behavior

/courses -> /course/1/navigation --> /course/1/information --> [back] [intercept]
                                 --> /course/1/leave (path changed, Component still `Information`)

In App.vue using router-view can achieve the goal, but using ion-router-outlet will not work.

 <template>
   <ion-app>
-    <!-- <ion-router-outlet></ion-router-outlet> -->
-    <router-view></router-view>
+    <ion-router-outlet></ion-router-outlet>
+    <!-- <router-view></router-view> -->
   </ion-app>
 </template>

Even after upgrading all dependencies to the latest version, the problem still exists. (2023-05-16)

"@ionic/core": "7.0.6",
"@ionic/vue": "7.0.6",
"@ionic/vue-router": "7.0.6",
"core-js": "^3.6.5",
"ionicons": "7.1.0",
"typescript": "5.0.4",
"vue": "^3.2.21",
"vue-router": "4.2.0"

Update 2023-05-17.

The issues using global Navigation Guard and using Component hook beforeRouteLeave are the same.

Returning to another page is a real need for some special pages. and vue-router implements it perfectly.

I found that navigation guards can intercept route push/replace but does not work for route back.

Ionic Framework GitHub Issue

ionic5-vue3-ts-example's People

Contributors

peixin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.