Skip to content

Commit 6eda9fa

Browse files
committed
feat(jsx-directive): support template-ref
1 parent c89ddce commit 6eda9fa

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

Diff for: playground/src/App.vue

+3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
<script setup lang="ts">
2+
import { shallowRef } from 'vue';
23
import Comp from './components/Comp.vue'
34
45
const list = [{ id: 1 }]
56
const bind = { }
67
const on = { submit: () => {} }
78
const select = $ref<{ id: number }>(list[0])
9+
const compRef = shallowRef()
810
</script>
911

1012
<template>
@@ -14,6 +16,7 @@ const select = $ref<{ id: number }>(list[0])
1416
:key="i.id"
1517
v-bind="bind"
1618
v-model:id="i.id"
19+
ref="compRef"
1720
v-loading.fullscreen.lock="true"
1821
v-memo="[select?.id === i.id]"
1922
v-on="on"

Diff for: src/rules/jsx-directive/v-bind.yml

+20
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,26 @@ fix: |-
2222
2323
---
2424

25+
id: v-template-ref
26+
language: html
27+
rule:
28+
kind: quoted_attribute_value
29+
pattern: $VALUE
30+
follows:
31+
kind: attribute_name
32+
regex: ^ref$
33+
stopBy: end
34+
transform:
35+
V:
36+
substring:
37+
startChar: 1
38+
endChar: -1
39+
source: $VALUE
40+
fix: |-
41+
{$V}
42+
43+
---
44+
2545
id: v-bind transform to {...props}
2646
language: html
2747
rule:

0 commit comments

Comments
 (0)