Skip to content

Commit

Permalink
fix: 调整页面动效 修复点击关键字的跳转问题
Browse files Browse the repository at this point in the history
  • Loading branch information
ZiuChen committed Apr 10, 2023
1 parent 6efbef2 commit 7c1a393
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 38 deletions.
18 changes: 1 addition & 17 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<template>
<router-view v-slot="{ Component }">
<transition name="opacity" mode="out-in" appear>
<component :is="Component" />
</transition>
</router-view>
<router-view> </router-view>
</template>

<script lang="ts" setup>
Expand All @@ -13,15 +9,3 @@ import { IS_DARK } from './common/symbol'
const isDark = useDarkMode()
provide(IS_DARK, isDark)
</script>

<style lang="less" scoped>
.opacity-enter-active,
.opacity-leave-active {
transition: opacity 0.1s ease-in-out;
}
.opacity-enter,
.opacity-leave-to {
opacity: 0;
}
</style>
8 changes: 4 additions & 4 deletions src/common/registerCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export function registerCallback() {
// 通过全局关键字打开文章
if (code.startsWith('note/')) {
const docId = code.split('/')[1]

emitWithWatch(ENTER_FILE, docId)
}

Expand Down Expand Up @@ -46,9 +45,10 @@ function emitWithWatch(event: symbol, payload?: any) {
if (store.isReady) {
$emit(event, payload)
} else {
// 如果当前在其他页面 则跳转回editor
if (window.location.pathname !== '/' && window.location.pathname !== 'editor')
window.history.back()
// 如果当前在其他页面 则跳转回editor页面
if (window.location.hash !== '#/editor') {
window.location.hash = '#/editor'
}

// 等待编辑器初始化完毕后emit
// 执行完毕后立刻cancel掉监听
Expand Down
20 changes: 3 additions & 17 deletions src/components/Features.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,9 @@
<a-tag>当前全局关键字为空</a-tag>
</div>
<template v-else v-for="f of features" :key="f.code">
<a-tag
class="feature"
@click="handleFeatureClick(f)"
@close="handleFeatureClose(f)"
:checked="true"
checkable
closable
>{{ f.cmds[0] }}</a-tag
>
<a-tag class="feature" @click="handleFeatureClick(f)" :checked="true" checkable>{{
f.cmds[0]
}}</a-tag>
</template>
</div>
</template>
Expand All @@ -32,14 +26,6 @@ import { Modal, Message } from '@arco-design/web-vue'
const features = ref<TFeature[] | undefined>(getFeatures())
/**
* 点击移除全局关键字
*/
function handleFeatureClose(feature: TFeature) {
const res = removeFeature(feature.code)
if (res) Message.success('成功移除全局关键字')
}
/**
* 点击跳转全局关键字
*/
Expand Down

0 comments on commit 7c1a393

Please sign in to comment.