html (elementUi中的表格,传入位置和当前值)
![在这里插入图片描述](https://img-blog.csdn.net/20181016160455222?watermark/2/text/aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzQzMjQ2MDEy/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70)
methods(生成input,将当前输入的value值等于当前单元格的值)
handleChangeCorrectValue(index, data) {
var target = event.target,
$target = $(target),
attachElement = null;
$target.hide();
if (attachElement != null) {
attachElement.hide();
}
var input = document.createElement("input");
input.type = "text";
input.value = data;
input.setAttribute("style", "width:149px;height:48px;text-align:center;box-sizing:border-box;");
target.parentNode.insertBefore(input, target);
input.focus();
var _this = this;
input.onblur = function() {
if (this.value) {
_this.cloneCorrectNumTableData[index].questionCorrectValue = this.value;
} else {
this.value = data;
}
_this.cloneCorrectNumTableData[index].questionCorrectValue = this.value;
input.parentNode.removeChild(input);
$target.show();
if (attachElement != null) {
attachElement.show();
}
};
input.onkeypress = function(e) {
if (e.keyCode == 13) {
this.blur();
}
};
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)