1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- <template>
- <el-dialog
- :title="title"
- :center="true"
- align="left"
- top="8vh"
- width="600px"
- @close="closeModel"
- :close-on-click-modal="false"
- :visible.sync="showModelThis"
- >
- <el-card>
- <el-row :gutter="10" >
- <el-col :span="24">
- <img class="activeImg" :src="activeImg" alt="" />
- </el-col>
- <el-col :span="24" style="text-align: right;padding-top:10px" v-if="imgList&&imgList.length>0">
- <div class="img-box">
- <img
- @click="initForm(i)"
- :class="{ active: activeIndex === i }"
- v-for="(img, i) in imgList"
- :key="'imgboxitem' + i"
- :src="img"
- alt=""
- />
- </div>
- </el-col>
- </el-row>
- </el-card>
- </el-dialog>
- </template>
- <script>
- export default {
- name: "goods",
- props: ["showModel", "imgList", "index"],
- data() {
- return {
- activeImg: "",
- activeIndex: this.index,
- showModelThis: this.showModel,
- };
- },
- methods: {
- closeModel() {
- this.showModelThis = false;
- },
- initForm(index) {
- this.activeIndex = index;
- this.activeImg = this.imgList[index];
- },
- },
- watch: {
- showModel: function (val) {
- this.showModelThis = val;
- if (val) {
- this.initForm(this.index);
- }
- },
- showModelThis(val) {
- if (!val) {
- this.$emit("cancel");
- }
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .goods {
- .activeImg {
- display: inline-block;
- width: 100%;
- }
- .img-box {
- img {
- width: 40px;
- height: 40px;
- display: inline-block;
- margin: 0 3px;
- border:1px solid transparent;
- &.active {
- border: 1px solid red;
- }
- &:hover {
- cursor: pointer;
- }
- }
- }
- }
- </style>
-
|