Browse Source

修复单个素材删除 vue报warn的问题

master
hupeng 4 years ago
parent
commit
b6494b13df
  1. 15
      src/components/singlematerial/index.vue

15
src/components/singlematerial/index.vue

@ -1,10 +1,10 @@
<template> <template>
<div v-if="type == 'image'"> <div v-if="type == 'image'">
<div v-if="value != ''"> <div v-if="myValue != ''">
<ul class="el-upload-list el-upload-list--picture-card"> <ul class="el-upload-list el-upload-list--picture-card">
<li tabindex="0" class="el-upload-list__item is-ready" :style="'width: '+width+'px;height: '+height+'px'"> <li tabindex="0" class="el-upload-list__item is-ready" :style="'width: '+width+'px;height: '+height+'px'">
<div> <div>
<img :src="value" alt="" class="el-upload-list__item-thumbnail"> <img :src="myValue" alt="" class="el-upload-list__item-thumbnail">
<span class="el-upload-list__item-actions"> <span class="el-upload-list__item-actions">
<span class="el-upload-list__item-delete" @click="deleteMaterial"> <span class="el-upload-list__item-delete" @click="deleteMaterial">
<i class="el-icon-delete" /> <i class="el-icon-delete" />
@ -90,7 +90,7 @@
show-icon show-icon
/> />
<el-row :gutter="5"> <el-row :gutter="5">
<el-checkbox-group v-model="urls" :max="num - value.length"> <el-checkbox-group v-model="urls" :max="num - myValue.length">
<el-col v-for="(item,index) in tableData" :key="index" :span="4"> <el-col v-for="(item,index) in tableData" :key="index" :span="4">
<el-card :body-style="{ padding: '5px' }"> <el-card :body-style="{ padding: '5px' }">
<el-image <el-image
@ -183,6 +183,7 @@ export default {
Authorization: getToken() Authorization: getToken()
}, },
dialogVisible: false, dialogVisible: false,
myValue: this.value,
url: '', url: '',
listDialogVisible: false, listDialogVisible: false,
materialgroupList: [], materialgroupList: [],
@ -208,6 +209,11 @@ export default {
'uploadApi' 'uploadApi'
]) ])
}, },
watch: {
value: function (val) {
this.myValue = val
}
},
methods: { methods: {
moveMaterial(index, type) { moveMaterial(index, type) {
if (type == 'up') { if (type == 'up') {
@ -232,7 +238,7 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
that.value = '' that.myValue = ''
that.urls = [] that.urls = []
}) })
}, },
@ -449,6 +455,7 @@ export default {
}, },
sureUrls() { sureUrls() {
console.log('this.urls:'+this.urls) console.log('this.urls:'+this.urls)
this.myValue = this.urls[0]
this.$emit('input', this.urls[0]) this.$emit('input', this.urls[0])
this.listDialogVisible = false this.listDialogVisible = false
} }

Loading…
Cancel
Save