8000 update: add section regarding null as a special value · vuejs/rfcs@6a0b7be · GitHub
[go: up one dir, main page]

Skip to content

Commit 6a0b7be

Browse files
committed
update: add section regarding null as a special value
1 parent 443b5fd commit 6a0b7be

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

active-rfcs/0000-dynamic-directive-arguments.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ In addition, `v-slot` doesn't have an equivalent object syntax, since it's value
8383
</foo>
8484
```
8585

86+
### Handling of `null` as Special Value
87+
88+
Dynamic argument values are expected to be strings. However, it would be convenient if we allow `null` as a special value that explicitly indicates that the binding should be removed. Any other non-string values are likely mistakes and will trigger a warning.
89+
90+
`null` as a special value only applies only to `v-bind` and `v-on`, since `v-slot` is not a binding and cannot be removed. Custom directives have the liberty of deciding how to handle non-string arguments, but are expected to follow the convention when it applies.
91+
8692
# Drawbacks / Considerations
8793

8894
### Constraints on expressions
@@ -101,7 +107,7 @@ Which does not work as expected. A workaround would be:
101107

102108
That said, complex dynamic key bindings should probably be pre-transformed in JavaScript via a computed property.
103109

104-
**Update:**: it should also be possible to detect such usage and provide proper warnings in the parser (by checking for arguments that are missing the closing bracket).
110+
**Update:**: it is possible to detect such usage and provide proper warnings in the parser (by checking for arguments that are missing the closing bracket).
105111

106112
### Custom Directives
107113

0 commit comments

Comments
 (0)
0