first #5

Merged
pficv7wyt merged 1 commits from branch1 into main 10 months ago

@ -0,0 +1,82 @@
<template>
<!-- 组件根容器 -->
<div>
<!-- 引入本地文件上传子组件使用 v-model 双向绑定文件地址通过 props 传递文件类型提示信息和列表类型 -->
<file-upload-local v-model="fileUrl" :accept="accept" :tips="tips" :list-type="listType" />
</div>
</template>
<script>
//
import FileUploadLocal from './local'
export default {
//
name: 'FileUpload',
//
components: { FileUploadLocal },
//
props: {
//
value: String,
//
accept: {
type: String,
default: '*'
},
//
tips: String,
//
listType: {
type: String,
default: 'picture'
}
},
//
data() {
return {
//
fileUrl: ''
}
},
//
watch: {
// value
value: {
handler() {
// value fillValue
this.fillValue()
}
},
//
fileUrl: {
handler() {
// input
this.$emit('input', this.fileUrl)
}
}
},
//
mounted() {
},
//
created() {
// fillValue
this.fillValue()
},
//
methods: {
/**
* 将父组件传递的 value 属性值赋值给本地的 fileUrl
*/
fillValue() {
this.fileUrl = this.value
}
}
}
</script>
Loading…
Cancel
Save