我使用以下脚本禁用了上传小部件,但我仍然可以使用拖放功能上传文件。这是一个错误还是我做错了什么?
<script type="text/javascript">
$(document).ready(function () {
$("#files").kendoUpload({
multiple: false,
async: {
saveUrl: save,
autoUpload: true
},
enabled: false
});
});
</script>
我称之为错误 - 这是您可以修复它的方法,直到 Telerik 这样做(演示):
kendo.ui.Upload.fn.toggle = function(enable) {
var that = this;
enable = typeof(enable) === "undefined" ? false : enable;
this.wrapper.toggleClass("k-state-disabled", !enable);
this.element.prop("disabled", !enable);
var dragZone = $(".k-dropzone", that.wrapper);
if (enable) {
if (!dragZone.length) {
this._setupDropZone();
} else {
dragZone.on("drop" + that._ns, $.proxy(this._onDrop, this));
}
} else {
dragZone.off("drop" + that._ns);
}
};
kendo.ui.Upload.fn._supportsDrop = function() {
var userAgent = this._userAgent().toLowerCase(),
isChrome = /chrome/.test(userAgent),
isSafari = !isChrome && /safari/.test(userAgent),
isWindowsSafari = isSafari && /windows/.test(userAgent);
return !isWindowsSafari && this._supportsFormData() && (this.options.async.saveUrl) && (this.options.enabled);
}
(在首次创建小部件之前添加此内容)