Commit e6973442 authored by 毛线's avatar 毛线

图片上传组件,单图情况默认使用string格式

parent 10d5608e
...@@ -97,6 +97,13 @@ export default{ ...@@ -97,6 +97,13 @@ export default{
this.$emit('input', data) this.$emit('input', data)
}, },
}, },
computed: {
computedDataType() {
const { dataType, limit } = this
console.log('limit', limit)
return limit === 1 ? 'string' : dataType
},
},
created() { created() {
this.list = this.init().data(this.value) this.list = this.init().data(this.value)
}, },
...@@ -106,7 +113,7 @@ export default{ ...@@ -106,7 +113,7 @@ export default{
// 初始化返回数据 // 初始化返回数据
value: (list) => { value: (list) => {
let value = '' let value = ''
const { dataType } = this const { computedDataType: dataType } = this
switch(dataType) { switch(dataType) {
case 'string': // 字符串类型以逗号隔开 case 'string': // 字符串类型以逗号隔开
value = list.join(',') value = list.join(',')
...@@ -123,7 +130,7 @@ export default{ ...@@ -123,7 +130,7 @@ export default{
// 初始化数据 // 初始化数据
data: (value) => { data: (value) => {
let data = '' let data = ''
const { dataType } = this const { computedDataType: dataType } = this
switch(dataType) { switch(dataType) {
case 'string': // 字符串类型以逗号隔开 case 'string': // 字符串类型以逗号隔开
data = value ? value.split(',') : [] data = value ? value.split(',') : []
......
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