transformAttr.js 779 B

1234567891011121314151617181920
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.transformAttr = void 0;
  4. const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
  5. const shared_1 = require("@vue/shared");
  6. const transformAttr = (node, _) => {
  7. if (!(0, uni_cli_shared_1.isElementNode)(node)) {
  8. return;
  9. }
  10. node.props.forEach((prop) => {
  11. if ((0, uni_cli_shared_1.isAttributeNode)(prop) && prop.value) {
  12. switch (prop.name) {
  13. case 'style':
  14. prop.value.content = (0, shared_1.stringifyStyle)((0, shared_1.parseStringStyle)(prop.value.content)).slice(0, -1); // 移除最后一个分号,省点大小吧
  15. break;
  16. }
  17. }
  18. });
  19. };
  20. exports.transformAttr = transformAttr;