♻️(document): 重构文档结构

This commit is contained in:
就眠儀式
2022-06-25 20:12:12 +08:00
parent b86b7d308c
commit 4636c7c38d
6 changed files with 61 additions and 42 deletions

View File

@@ -25,4 +25,4 @@ const src = computed(() => {
frameborder="0"
:src="src"
></iframe>
</template>
</template>

View File

@@ -3,13 +3,27 @@
<img :src="imgList[index].src" />
<div class="layui-layer-imgsee" v-if="imgList.length > 0">
<span class="layui-layer-imguide" v-if="imgList.length > 1">
<a href="javascript:;" class="layui-layer-iconext layui-layer-imgprev" @click="changeIndex(-1)"></a>
<a href="javascript:;" class="layui-layer-iconext layui-layer-imgnext" @click="changeIndex(1)"></a>
<a
href="javascript:;"
class="layui-layer-iconext layui-layer-imgprev"
@click="changeIndex(-1)"
></a>
<a
href="javascript:;"
class="layui-layer-iconext layui-layer-imgnext"
@click="changeIndex(1)"
></a>
</span>
<div class="layui-layer-imgbar" style="display: block" v-if="imgList.length > 1 || imgList[index].alt">
<div
class="layui-layer-imgbar"
style="display: block"
v-if="imgList.length > 1 || imgList[index].alt"
>
<span class="layui-layer-imgtit">
<span v-if="imgList[index].alt">{{ imgList[index].alt }}</span>
<em v-if="imgList.length > 1">{{ index + 1 }} / {{ imgList.length }}</em>
<em v-if="imgList.length > 1"
>{{ index + 1 }} / {{ imgList.length }}</em
>
</span>
</div>
</div>
@@ -24,7 +38,7 @@ export default {
import { watch, ref } from "vue";
export interface LayPhotoProps {
imgList: { src: string, alt: string }[];
imgList: { src: string; alt: string }[];
startIndex: number;
}
const emit = defineEmits(["resetCalculationPohtosArea"]);
@@ -34,18 +48,18 @@ const props = withDefaults(defineProps<LayPhotoProps>(), {
const index = ref(props.startIndex);
watch(index, () => {
//当图片索引改变的时候 重新计算弹层的大小
emit('resetCalculationPohtosArea', index.value)
})
emit("resetCalculationPohtosArea", index.value);
});
const changeIndex = (step: number) => {
let nowIndex = index.value
let next = nowIndex + step
let nowIndex = index.value;
let next = nowIndex + step;
if (next < 0) {
next = props.imgList.length - 1
next = props.imgList.length - 1;
}
if (next >= props.imgList.length) {
next = 0
next = 0;
}
index.value = next
}
index.value = next;
};
</script>

View File

@@ -55,7 +55,17 @@ export interface LayModalProps {
btn?: Record<string, Function>[] | false;
move?: boolean | string;
resize?: boolean | string;
type?: 0 | 1 | 2 | 3 | "dialog" | "page" | "iframe" | "loading" | "drawer" | "photos";
type?:
| 0
| 1
| 2
| 3
| "dialog"
| "page"
| "iframe"
| "loading"
| "drawer"
| "photos";
content?: string | Function | object | VNodeTypes;
isHtmlFragment?: boolean;
shade?: boolean | string;