mirror of https://github.com/layui/layui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
601 B
24 lines
601 B
2 years ago
|
<button type="button" class="layui-btn layui-btn-danger" id="ID-upload-demo-size">
|
||
|
<i class="layui-icon layui-icon-upload"></i> 上传图片
|
||
|
</button>
|
||
|
<div class="layui-inline layui-word-aux">
|
||
|
这里以限制 60KB 为例
|
||
|
</div>
|
||
|
|
||
|
<script>
|
||
|
layui.use(function(){
|
||
|
var upload = layui.upload;
|
||
|
var layer = layui.layer;
|
||
|
|
||
|
// 渲染
|
||
|
upload.render({
|
||
|
elem: '#ID-upload-demo-size',
|
||
|
url: '', // 此处配置你自己的上传接口即可
|
||
|
size: 60, // 限制文件大小,单位 KB
|
||
|
done: function(res){
|
||
|
layer.msg('上传成功');
|
||
|
console.log(res);
|
||
|
}
|
||
|
});
|
||
|
});
|
||
|
</script>
|