You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
839 B
29 lines
839 B
|
2 months ago
|
"use strict";
|
||
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
|
exports.transformText = void 0;
|
||
|
|
const uni_cli_shared_1 = require("@dcloudio/uni-cli-shared");
|
||
|
|
const compiler_core_1 = require("@vue/compiler-core");
|
||
|
|
const transformText = (node, _) => {
|
||
|
|
if (!(0, uni_cli_shared_1.isElementNode)(node)) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
const dir = (0, compiler_core_1.findDir)(node, 'text');
|
||
|
|
if (!dir) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
// remove v-text
|
||
|
|
node.props.splice(node.props.indexOf(dir), 1);
|
||
|
|
if (node.tagType !== compiler_core_1.ElementTypes.ELEMENT) {
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
node.isSelfClosing = false;
|
||
|
|
node.children = [
|
||
|
|
{
|
||
|
|
type: compiler_core_1.NodeTypes.INTERPOLATION,
|
||
|
|
loc: dir.exp.loc,
|
||
|
|
content: dir.exp,
|
||
|
|
},
|
||
|
|
];
|
||
|
|
};
|
||
|
|
exports.transformText = transformText;
|