实现效果。点击父页面图片,进入放大图页面。点击大图切换,小图片也进行切换,点击小图片,大图片跟着切换
一:弹框页面 接收父组件传递的图片列表数据,以及当前点击放大的图片url
<el-dialog
v-model="dialogVisible"
@close="closeDialog"
destroy-on-close
:close-on-click-modal="false"
width="500px"
>
//引用子组件
<PlusImage
:dialogImageUrl="dialogImageUrl"
:fileList="fileList"
></PlusImage>
</el-dialog>
<script lang="ts" setup>
import { defineProps, ref, watch, defineEmits } from "vue";
import PlusImage from "./PlusImage.vue";
//定义弹框的显示隐藏
const dialogVisible = ref(false);
const emit = defineEmits(["closeVisible"]);
const dialogImageUrl: any = ref("");
//接收父组件传递的数据
const props = defineProps({
dialogImageUrl: String,
fileList: Array,
dialogVisible: Boolean,
});
const fileList: any = ref