一、Input框限制二、方法限制
一、Input框限制
使用accept属性进行文件夹默认选项的限制
<input #file type
="file" accept
="image/*" />
效果:
但是,这种设置也是可以进行人为更换的,所以还需要以下内容的补充
二、方法限制
var RightType
= ["jpeg", "jpg", "png", "bmp"];
var fileType
= "png";
var isbool
= RightType
.includes(fileType
);
if (isbool
== true) {
}else {
};
转载请注明原文地址: https://yun.8miu.com/read-138393.html