vue使用webuploader
时间: 2023-08-25 15:06:41 浏览: 210
Vue使用WebUploader可以按照以下步骤进行:
1. 在index.html中引入WebUploader的js文件。可以使用以下代码将webuploader.min.js文件引入到index.html中:
```html
<script src="./static/webuploader-0.1.5/webuploader.min.js"></script>
```
\[1\]\[2\]
2. 在Vue组件的mounted生命周期内实例化WebUploader并进行配置。可以在App.vue的mounted函数中添加以下代码:
```javascript
mounted: function() {
var uploader = WebUploader.create({
// swf文件路径
swf: '../static/webuploader-0.1.5/Uploader.swf',
// 文件接收服务端
server: 'http://webuploader.duapp.com/server/fileupload.php',
// 选择文件的按钮
// 内部根据当前运行是创建,可能是input元素,也可能是flash
pick: '#picker',
// 不压缩image,默认如果是jpeg,文件上传前会压缩一把再上传
resize: false,
// 是否开启自动上传
auto: false
});
}
```
\[3\]
这样就完成了Vue中使用WebUploader的配置。你可以根据自己的需求进行进一步的配置和使用。
#### 引用[.reference_title]
- *1* *2* [vue结合WebUploader插件实现大文件分片上传](https://blog.csdn.net/qq_33414883/article/details/104550359)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [在Vue项目中使用WebUploader实现文件上传](https://blog.csdn.net/weixin_42205101/article/details/96736956)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^control,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文
相关推荐
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)