Commit 465531bd by 高源

优化

parent ddfd24b9
......@@ -64,7 +64,7 @@ function table () {
this.getData = function () {
let rtns = [];//定义返回值
if (!_isVerified) return null;//如果还没通过验证不返回数据
let rowIndex = 0;
let rowIndex = 1;
while (true) {
let result = {}
this.cells.forEach(cell => cell.getData(result, rowIndex));
......@@ -123,13 +123,13 @@ function cell (xpath, name = "", type = "", title = "") {
*/
this.isExist = function () {
let existCount = 0;
let _tableXpathArrays = [..._tableXpathArray]; //深拷贝,值修改不影响原数组
let _relativeXpathArrays = [..._relativeXpathArray];//深拷贝,值修改不影响原数组
_tableXpathArrays = _tableXpathArray.join('/')
_relativeXpathArrays = _relativeXpathArray.join('/')
for (let i = 0; i < 3; i++) {
// let _tableXpathArrays = [..._tableXpathArray]; //深拷贝,值修改不影响原数组
// let _relativeXpathArrays = [..._relativeXpathArray];//深拷贝,值修改不影响原数组
let _tableXpathArrays = _tableXpathArray.join('/')
let _relativeXpathArrays = _relativeXpathArray.join('/')
for (let i = 1; i < 3; i++) {
// 验证是否能找到元素
let _xpath = _tableXpathArrays + '[' + (i + 1) + ']' + '/' + _relativeXpathArrays;
let _xpath = _tableXpathArrays + '[' + i + ']' + '/' + _relativeXpathArrays;
let result = document.evaluate(_xpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if (!!result.singleNodeValue) {
existCount++;
......@@ -148,7 +148,7 @@ function cell (xpath, name = "", type = "", title = "") {
* @param {int} index 索引号
*/
this.getData = function (result, index) {
let realXpath = this.tableXpath + "[" + (index + 1) + "]" + '/' + this.relativeXpath;
let realXpath = this.tableXpath + "[" + index + "]" + '/' + this.relativeXpath;
let results = document.evaluate(realXpath, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
if (!!results.singleNodeValue) {
// 后续处理type类型事件
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment