fix: setup 迁移完成 v1

This commit is contained in:
Tim
2025-08-14 10:27:01 +08:00
parent 902fce5174
commit 655e8f2a65
33 changed files with 289 additions and 393 deletions

View File

@@ -37,7 +37,7 @@
<script setup>
import { ref, onMounted, computed } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import { useRoute } from 'vue-router'
import PostEditor from '~/components/PostEditor.vue'
import CategorySelect from '~/components/CategorySelect.vue'
import TagSelect from '~/components/TagSelect.vue'
@@ -56,7 +56,6 @@ const isAiLoading = ref(false)
const isLogin = computed(() => authState.loggedIn)
const route = useRoute()
const router = useRouter()
const postId = route.params.id
const loadPost = async () => {
@@ -197,7 +196,7 @@ const submitPost = async () => {
}
}
const cancelEdit = () => {
router.push(`/posts/${postId}`)
navigateTo(`/posts/${postId}`, { replace: true })
}
</script>

View File

@@ -343,7 +343,7 @@ const startCountdown = () => {
updateCountdown()
countdownTimer = setInterval(updateCountdown, 1000)
}
const gotoUser = (id) => router.push(`/users/${id}`)
const gotoUser = (id) => navigateTo(`/users/${id}`, { replace: true })
const articleMenuItems = computed(() => {
const items = []
if (isAuthor.value || isAdmin.value) {
@@ -394,7 +394,7 @@ const mapComment = (c, parentUserName = '', level = 0) => ({
reply: (c.replies || []).map((r) => mapComment(r, c.author.username, level + 1)),
openReplies: level === 0,
src: c.author.avatar,
iconClick: () => router.push(`/users/${c.author.id}`),
iconClick: () => navigateTo(`/users/${c.author.id}`, { replace: true }),
parentUserName: parentUserName,
})
@@ -641,7 +641,7 @@ const unpinPost = async () => {
}
const editPost = () => {
router.push(`/posts/${postId}/edit`)
navigateTo(`/posts/${postId}/edit`, { replace: true })
}
const deletePost = async () => {
@@ -656,7 +656,7 @@ const deletePost = async () => {
})
if (res.ok) {
toast.success('已删除')
router.push('/')
navigateTo('/', { replace: true })
} else {
toast.error('操作失败')
}
@@ -766,7 +766,7 @@ const jumpToHashComment = async () => {
}
const gotoProfile = () => {
router.push(`/users/${author.value.id}`)
navigateTo(`/users/${author.value.id}`, { replace: true })
}
onMounted(async () => {