Commit 243c82f3 authored by 廖伟胜's avatar 廖伟胜

修改子父组件循环调用问题

parent e6973442
...@@ -85,14 +85,16 @@ export default{ ...@@ -85,14 +85,16 @@ export default{
dialog_visible: false, dialog_visible: false,
qiniuToken: '', qiniuToken: '',
list: [], // 文件列表 list: [], // 文件列表
data:[],
index: '', index: '',
} }
}, },
watch: { watch: {
value(value) { value(value) {
this.list = this.init().data(value) this.list = this.init().data(value);
this.data = this.list;
}, },
list(value) { data(value) {
const data = this.init().value(value) const data = this.init().value(value)
this.$emit('input', data) this.$emit('input', data)
}, },
...@@ -100,7 +102,6 @@ export default{ ...@@ -100,7 +102,6 @@ export default{
computed: { computed: {
computedDataType() { computedDataType() {
const { dataType, limit } = this const { dataType, limit } = this
console.log('limit', limit)
return limit === 1 ? 'string' : dataType return limit === 1 ? 'string' : dataType
}, },
}, },
...@@ -113,7 +114,7 @@ export default{ ...@@ -113,7 +114,7 @@ export default{
// 初始化返回数据 // 初始化返回数据
value: (list) => { value: (list) => {
let value = '' let value = ''
const { computedDataType: dataType } = this const { computedDataType: dataType } = this
switch(dataType) { switch(dataType) {
case 'string': // 字符串类型以逗号隔开 case 'string': // 字符串类型以逗号隔开
value = list.join(',') value = list.join(',')
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<i v-else :style="style" class="avatar el-icon-plus avatar-uploader-icon"> <i v-else :style="style" class="avatar el-icon-plus avatar-uploader-icon">
<span class="upload-label">{{ label }}</span> <span class="upload-label">{{ label }}</span>
</i> </i>
</el-upload> </el-upload>
<span class="upload-tips">{{ tips }}</span> <span class="upload-tips">{{ tips }}</span>
</div> </div>
...@@ -95,6 +96,8 @@ export default{ ...@@ -95,6 +96,8 @@ export default{
}, },
src() { src() {
const { data, imgDomain } = this const { data, imgDomain } = this
console.log(data);
const reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/ const reg = /^([hH][tT]{2}[pP]:\/\/|[hH][tT]{2}[pP][sS]:\/\/)(([A-Za-z0-9-~]+)\.)+([A-Za-z0-9-~\/])+$/
if (reg.test(data)) { if (reg.test(data)) {
return data return data
......
...@@ -15,10 +15,11 @@ ...@@ -15,10 +15,11 @@
:size="size" :size="size"
/> />
<UploadFile v-if="type === 'file'" <UploadFile v-if="type === 'file'"
:label="label" :label="label"
:limit="limit" :limit="limit"
v-model="value" v-model="value"
:edit="edit" :edit="edit"
:data-type="dataType"
:dialog="dialog" :dialog="dialog"
:tips="tips" :tips="tips"
:source="source" :source="source"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment