Vue中父子组件传值的问题!!!急求,拜托!!图片画圈的地方怎样取到accept的值

      <slice-upload 
        ref="upload" 
        :action="uploadUrl"
        type="drag"
        accept=".xls"
        :direct="true"
        :max-size="1048576"
        :on-progress="draging"
        :on-exceeded-size="handleMaxSize"
        :on-success="handleSuccess"
        :on-error="handleError"
        :on-status-change="changeStatus">
      <div v-if="uploadIsSelect" class="upload-button-file">
          <span class="plus fileplus">+</span>
          选择/拖拽上传文件
          <br><span class="plusFileplus">支持上传excel文件</span>
        </div>
        <p v-else class="upload-button-drag"><span class="plus ">+</span>文件拖拽到这里</p>
      </slice-upload>![图片描述][1]

图片描述

图片描述

props: {

action: {
  type: String,
  required: true
},
headers: {
  type: Object,
  default() {
    return {};
  }
},
multiple: {
  type: Boolean,
  default: false
},
data: {
  type: Object
},
name: {
  type: String,
  default: 'file'
},
withCredentials: {
  type: Boolean,
  default: false
},
showUploadList: {
  type: Boolean,
  default: true
},
type: {
  type: String,
  validator(value) {
    return oneOf(value, ['select', 'drag']);
  },
  default: 'select'
},
format: {
  type: Array,
  default() {
    return [];
  }
},
accept: {
  type: String
},
maxSize: {
  type: Number
},
beforeUpload: Function,
onProgress: {
  type: Function,
  default() {
    return {};
  }
},
onSuccess: {
  type: Function,
  default() {
    return {};
  }
},
onError: {
  type: Function,
  default() {
    return {};
  }
},
onRemove: {
  type: Function,
  default() {
    return {};
  }
},
onPreview: {
  type: Function,
  default() {
    return {};
  }
},
onExceededSize: {
  type: Function,
  default() {
    return {};
  }
},
onFormatError: {
  type: Function,
  default() {
    return {};
  }
},
defaultFileList: {
  type: Array,
  default() {
    return [];
  }
},
onStatusChange: Function,
direct: {
  type: Boolean,
  default: false
}

},

阅读 1.8k
2 个回答
methods:{
  forEach(){
    let that=this
    this.files.forEach(file=>{
      file.ext==that.accept
    })
  }
}

方法里面可以先用一个变量把 vue 的this存一下,然后通过这个变量拿到 $props值咯

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题