utiller 1.0.261 → 1.0.263
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/utiller/index.js +14 -21
- package/package.json +1 -1
- package/template/sample.package.json +1 -1
package/lib/utiller/index.js
CHANGED
|
@@ -2949,14 +2949,13 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
2949
2949
|
}()
|
|
2950
2950
|
/** puppeteer 的 write dom function
|
|
2951
2951
|
* 使用這個function的朋友必須安裝puppeteer:v23.6
|
|
2952
|
-
* attribute = {name:value};
|
|
2952
|
+
* attribute = {name:value}; // {value:'100000'}, {src:'http://123.com'}
|
|
2953
2953
|
* */
|
|
2954
2954
|
)
|
|
2955
2955
|
}, {
|
|
2956
|
-
key: "
|
|
2956
|
+
key: "writeElementAttributes",
|
|
2957
2957
|
value: (function () {
|
|
2958
|
-
var
|
|
2959
|
-
var _this4 = this;
|
|
2958
|
+
var _writeElementAttributes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(dom, stringOfTrait) {
|
|
2960
2959
|
var element,
|
|
2961
2960
|
_len25,
|
|
2962
2961
|
attributes,
|
|
@@ -2977,20 +2976,14 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
2977
2976
|
break;
|
|
2978
2977
|
}
|
|
2979
2978
|
_context9.next = 7;
|
|
2980
|
-
return
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
} catch (err) {
|
|
2989
|
-
_iterator19.e(err);
|
|
2990
|
-
} finally {
|
|
2991
|
-
_iterator19.f();
|
|
2992
|
-
}
|
|
2993
|
-
}, element, attributes);
|
|
2979
|
+
return element.evaluate(function (element, attributes) {
|
|
2980
|
+
attributes.map(function (attr) {
|
|
2981
|
+
var entries = Object.entries(attr);
|
|
2982
|
+
var key = entries[0][0]; // 获取键 'name'
|
|
2983
|
+
var value = entries[0][1]; // 获取值 'value'
|
|
2984
|
+
element[key] = value;
|
|
2985
|
+
});
|
|
2986
|
+
}, attributes);
|
|
2994
2987
|
case 7:
|
|
2995
2988
|
_context9.next = 10;
|
|
2996
2989
|
break;
|
|
@@ -3002,10 +2995,10 @@ var Utiller = /*#__PURE__*/function () {
|
|
|
3002
2995
|
}
|
|
3003
2996
|
}, _callee8, this);
|
|
3004
2997
|
}));
|
|
3005
|
-
function
|
|
3006
|
-
return
|
|
2998
|
+
function writeElementAttributes(_x6, _x7) {
|
|
2999
|
+
return _writeElementAttributes.apply(this, arguments);
|
|
3007
3000
|
}
|
|
3008
|
-
return
|
|
3001
|
+
return writeElementAttributes;
|
|
3009
3002
|
}())
|
|
3010
3003
|
}]);
|
|
3011
3004
|
}();
|
package/package.json
CHANGED