Skip to content

Commit e0d1705

Browse files
committed
fix: update #3
1 parent 6d79615 commit e0d1705

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

vue-transformations/v-bind-order-sensitive.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,14 @@ function fix(node: Node, source: string): Operation[] {
4444
// get parent node
4545
const target: any = node!.parent;
4646
// get the value of v-bind according to the range
47-
let bindValue:string = source.slice(node.range[0], node.range[1]);
48-
47+
const bindValue:string = source.slice(node.range[0], node.range[1]) + ' ';
48+
// remove node
4949
if (target.attributes[target.attributes.length -1] === node) {
50-
bindValue += ' ';
50+
fixOperations.push(OperationUtils.remove(node));
51+
}
52+
else {
53+
fixOperations.push(OperationUtils.removeRange([node.range[0], node.range[1] + 1]));
5154
}
52-
// remove node
53-
fixOperations.push(OperationUtils.remove(node));
5455
// add node to the first
5556
fixOperations.push(OperationUtils.insertTextBefore(target.attributes[0],bindValue));
5657
return fixOperations

0 commit comments

Comments
 (0)