| description | 上传组件(ElUpload)的定义和使用说明 |
|---|
上传组件必填的字段,请固定按下面的格式:
- action 为上传接口地址,固定为 "/upload"。不要修改。
- urlField 为返回的文件路径字段,固定为 "filePath"。不要修改。
- modelValue 为双向绑定的 url 值,单文件时为 url 字符串,多文件时为 url 用","拼接的字符串。
- slotTrigger 为上传按钮的区域,可以是按钮、文本或图标等。
- 一般情况下双向绑定够用,不需要用事件处理。
<ElUpload action="/upload" urlField="filePath" modelValue={$sync(variable1)} slotTrigger={() => <ElButton text="上传文件" />} />
<ElUpload action="/upload" urlField="filePath" modelValue={$sync(variable1)} multiple={true} drag={true} slotTrigger={() => <ElButton text="点击上传" />} />
<ElUpload action="/upload" urlField="filePath" modelValue={$sync(variable1)} listType="picture" slotTrigger={() => <ElButton text="上传图片" />} />
<ElUpload action="/upload" urlField="filePath" modelValue={$sync(variable1)} listType="picture-card" slotTrigger={() => <ElButton text="上传图片" />} />