failed to set the 'value' property on 'htmlinputelement': this input element accepts a filename, which may only be programmatically set to the empty string.
时间: 2023-05-03 14:01:15 浏览: 1237
在HTML中的输入框元素只能设置为空字符串,无法通过编程方式设置为其它值,因此出现了“在'htmlinputelement'上设置'value'属性失败:该输入元素只接受文件名,只能以编程方式设置为空字符串”。
相关问题
webuploader.fis.js:4920 Uncaught TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them at HTMLInputElement.<anonymous> (webuploader.fis.js:4920:40) at HTML
这个错误提示是因为在严格模式下,不允许对 `arguments` 对象、`caller` 属性和 `callee` 属性进行访问。在 WebUploader 的 `webuploader.fis.js` 文件中可能使用了这些不允许的语法导致了这个错误。
要解决这个问题,有两种方法:
1. 将 WebUploader 的 `webuploader.fis.js` 文件中的所有 `function` 声明改为箭头函数,因为箭头函数没有自己的 `this`,`arguments`,`super` 或 `new.target`,这些都是继承自外部函数的。
2. 在使用 WebUploader 的时候,将严格模式关闭。可以通过在 `main.js` 中设置 `Vue.config.devtools = true` 和 `Vue.config.productionTip = false` 来关闭严格模式。
```javascript
// main.js
import Vue from 'vue'
import App from './App.vue'
Vue.config.productionTip = false
Vue.config.devtools = true // 关闭严格模式
new Vue({
render: h => h(App)
}).$mount('#app')
```
以上两种方法都可以解决这个问题。
.split is not a function at htmlinputelement.parser
.split is not a function at htmlinputelement.parser。
这个错误的发生通常是因为.split()方法被错误地在一个对象上调用,而这个对象是由HTMLInputElement.parser返回的,而不是一个有效的字符串。
通常来说,.split()是用来将一个字符串分割成数组的方法。这个方法只能被字符串类型的变量调用,而不能被其他类型的变量或对象调用。
在这种情况下,可能是在使用.split()方法之前没有正确地将返回的对象转换为字符串。为了解决这个问题,我们可以使用toString()方法将HTMLInputElement.parser返回的对象转换为字符串,然后再调用.split()方法。
例如:
var inputValue = document.getElementById("input").value.toString(); // 将返回的对象转换为字符串
var splitInput = inputValue.split(" "); // 使用.split()方法分割字符串
这样,我们就能够正确地使用.split()方法并将输入的值分割成数组,而不再出现".split is not a function at htmlinputelement.parser"的错误。