Skip to content

Commit

Permalink
feat: Add “replace” use case to playground.
Browse files Browse the repository at this point in the history
  • Loading branch information
chenweiyi committed May 18, 2023
1 parent f5345eb commit 46f9fa8
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
13 changes: 12 additions & 1 deletion playground/src/views/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,25 @@ async function go() {
console.log(e)
}
}
async function replace() {
try{
await router.replace(`/some/${Math.random() * 100}`)
}catch(e) {
console.log(e)
}
}
</script>

<template>
<div class="text-center">
<HelloWorld msg="Hello World"></HelloWorld>
<button @click="go">
<button @click="go" class="mr-8px">
Go somewhere.
</button>
<button @click="replace">
replace somewhere.
</button>
</div>
</template>

Expand Down
20 changes: 17 additions & 3 deletions playground/src/views/Some.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ async function go() {
console.log(e)
}
}
async function replace() {
try{
await router.replace(`/some/${Math.random() * 100}`)
}catch(e) {
console.log(e)
}
}
</script>

<template>
Expand All @@ -20,9 +28,15 @@ async function go() {
This is a test page. The id is {{ id }}.
</div>

<button @click="go">
Go somewhere.
</button>
<div>
<button @click="go" class="mr-8px">
Go somewhere.
</button>

<button @click="replace">
replace somewhere.
</button>
</div>
</div>
</template>

Expand Down

0 comments on commit 46f9fa8

Please sign in to comment.