fix: click paragraph card
This commit is contained in:
parent
371ee61c24
commit
48c59b59a8
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<MdPreview :language="language" noIconfont noPrettier :codeFoldable="false" v-bind="$attrs" />
|
<MdPreview :language="language" noIconfont noPrettier :codeFoldable="false" v-bind="$attrs" @click.stop="handleClick"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@ -11,6 +11,9 @@ import useStore from '@/stores'
|
|||||||
import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW'
|
import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW'
|
||||||
|
|
||||||
defineOptions({ name: 'MdPreview' })
|
defineOptions({ name: 'MdPreview' })
|
||||||
|
|
||||||
|
const emit = defineEmits(['clickPreview'])
|
||||||
|
|
||||||
const { user } = useStore()
|
const { user } = useStore()
|
||||||
const language = computed(() => user.getLanguage() || getBrowserLang() || '')
|
const language = computed(() => user.getLanguage() || getBrowserLang() || '')
|
||||||
config({
|
config({
|
||||||
@ -20,6 +23,14 @@ config({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function handleClick(e: MouseEvent) {
|
||||||
|
if ((e.target as HTMLElement).closest('a') || (e.target as HTMLElement).closest('.md-editor-copy-button')) {
|
||||||
|
e.stopPropagation()
|
||||||
|
} else {
|
||||||
|
emit('clickPreview')
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
:class="data.is_active ? '' : 'disabled'"
|
:class="data.is_active ? '' : 'disabled'"
|
||||||
@mouseenter="cardEnter()"
|
@mouseenter="cardEnter()"
|
||||||
@mouseleave="cardLeave()"
|
@mouseleave="cardLeave()"
|
||||||
@click.stop="editParagraph(data)"
|
@click.stop="handleClickCard(data)"
|
||||||
v-loading="loading"
|
v-loading="loading"
|
||||||
>
|
>
|
||||||
<div v-show="show" class="mk-sticky" v-if="!disabled">
|
<div v-show="show" class="mk-sticky" v-if="!disabled">
|
||||||
@ -94,6 +94,7 @@
|
|||||||
:modelValue="data.content"
|
:modelValue="data.content"
|
||||||
class="maxkb-md"
|
class="maxkb-md"
|
||||||
style="background: none"
|
style="background: none"
|
||||||
|
@clickPreview="handleClickCard(data)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<ParagraphDialog
|
<ParagraphDialog
|
||||||
@ -136,7 +137,7 @@ const apiType = computed(() => {
|
|||||||
return type as 'systemShare' | 'workspace' | 'systemManage'
|
return type as 'systemShare' | 'workspace' | 'systemManage'
|
||||||
})
|
})
|
||||||
|
|
||||||
const emit = defineEmits(['changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move'])
|
const emit = defineEmits(['clickCard','changeState', 'deleteParagraph', 'refresh', 'refreshMigrateParagraph','move'])
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const changeStateloading = ref(false)
|
const changeStateloading = ref(false)
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
@ -201,6 +202,14 @@ function editParagraph(row: any) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function handleClickCard(row: any) {
|
||||||
|
if (!props.disabled) {
|
||||||
|
editParagraph(row)
|
||||||
|
}else {
|
||||||
|
emit('clickCard')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function addParagraph(row: any) {
|
function addParagraph(row: any) {
|
||||||
title.value = t('views.paragraph.addParagraph')
|
title.value = t('views.paragraph.addParagraph')
|
||||||
ParagraphDialogRef.value.open(row, 'add')
|
ParagraphDialogRef.value.open(row, 'add')
|
||||||
|
|||||||
@ -96,7 +96,7 @@
|
|||||||
<!-- 批量操作 -->
|
<!-- 批量操作 -->
|
||||||
<div class="paragraph-card flex w-full" v-if="isBatch === true">
|
<div class="paragraph-card flex w-full" v-if="isBatch === true">
|
||||||
<el-checkbox :value="item.id" />
|
<el-checkbox :value="item.id" />
|
||||||
<ParagraphCard :data="item" class="mb-8 w-full" :disabled="true" />
|
<ParagraphCard :data="item" class="mb-8 w-full" :disabled="true" @clickCard="toggleSelect(item.id)"/>
|
||||||
</div>
|
</div>
|
||||||
<!-- 非批量操作 -->
|
<!-- 非批量操作 -->
|
||||||
<div class="handle paragraph-card flex w-full" :id="item.id" v-else>
|
<div class="handle paragraph-card flex w-full" :id="item.id" v-else>
|
||||||
@ -205,6 +205,15 @@ const handleClick = (e: MouseEvent, ele: any) => {
|
|||||||
const isBatch = ref(false)
|
const isBatch = ref(false)
|
||||||
const multipleSelection = ref<any[]>([])
|
const multipleSelection = ref<any[]>([])
|
||||||
|
|
||||||
|
function toggleSelect(id: number) {
|
||||||
|
const index = multipleSelection.value.indexOf(id)
|
||||||
|
if (index === -1) {
|
||||||
|
multipleSelection.value.push(id)
|
||||||
|
} else {
|
||||||
|
multipleSelection.value.splice(index, 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const paginationConfig = reactive({
|
const paginationConfig = reactive({
|
||||||
current_page: 1,
|
current_page: 1,
|
||||||
page_size: 30,
|
page_size: 30,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user