feat(uniapp): 多行展示商品名
This commit is contained in:
1 parent
0e117875c7
commit
c902d018d9
3 files changed
+34
-22
No files matched your search
@@ -185,7 +185,7 @@ import { getPage, addObj, delObj } from '@/api/tools/material'
|
||||
|
||||
const props = defineProps({
|
||||
modelValue: {
|
||||
type: Array,
|
||||
type: [String, Array],
|
||||
default() {
|
||||
return []
|
||||
}
|
||||
@@ -280,15 +280,10 @@ function deleteMaterial(index) {
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(function () {
|
||||
value.value.splice(index, 1)
|
||||
const nextValue = [...value.value]
|
||||
nextValue.splice(index, 1)
|
||||
urls.value = []
|
||||
// if (urls.value.length > 1 || props.num > 1) {
|
||||
// emit('update:modelValue', urls.value)
|
||||
// } else {
|
||||
// emit('update:modelValue', urls.value[0])
|
||||
// }
|
||||
emit('update:modelValue', value.value)
|
||||
|
||||
emitMaterialValue(nextValue)
|
||||
})
|
||||
}
|
||||
function toSeleteMaterial() {
|
||||
@@ -472,20 +467,16 @@ function beforeUpload(file) {
|
||||
}
|
||||
|
||||
const emit = defineEmits(['update:modelValue'])
|
||||
function emitMaterialValue(materials) {
|
||||
emit('update:modelValue', props.num === 1 ? (materials[0] || '') : materials)
|
||||
}
|
||||
|
||||
function sureUrls() {
|
||||
console.log('value.value.length:',value.value.length)
|
||||
urls.value.forEach((item) => {
|
||||
value.value[value.value.length] = item
|
||||
})
|
||||
console.log('urls.value:',value.value)
|
||||
const nextValue = [...value.value, ...urls.value]
|
||||
console.log('urls.value:',nextValue)
|
||||
listDialogVisible.value = false
|
||||
if (urls.value.length > 1 || props.num > 1) {
|
||||
emit('update:modelValue', value.value)
|
||||
} else {
|
||||
emit('update:modelValue', value.value[0])
|
||||
}
|
||||
|
||||
|
||||
emitMaterialValue(nextValue)
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
Reference in new issue
Block a user