瀏覽代碼

use characterByIdQuery

Jason Gorst 1 月之前
父節點
當前提交
9be7e33d06
共有 1 個文件被更改,包括 27 次插入0 次删除
  1. 27 0
      app/pages/show.vue

+ 27 - 0
app/pages/show.vue

@@ -0,0 +1,27 @@
+<template>
+  <div>
+    <SpinnerModal
+      v-if="isLoading"
+      :visible="true"
+    />
+
+    <CharacterEditor
+      v-else
+      action="view"
+      :characterId="characterId"
+      :initialValue="character"
+    />
+  </div>
+</template>
+
+<script setup>
+definePageMeta({
+  name: "characterView",
+  path: "/show/:characterId(\\d+)"
+})
+
+const characterId = _toInteger(useRoute().params?.characterId)
+const { data: character, isLoading } = useQuery(() => characterByIdQuery(characterId))
+</script>
+
+<style scoped></style>