Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not possible to use Symbol value for checkbox true-value #10597

Open
mitar opened this issue Mar 26, 2024 · 6 comments
Open

Not possible to use Symbol value for checkbox true-value #10597

mitar opened this issue Mar 26, 2024 · 6 comments

Comments

@mitar
Copy link

mitar commented Mar 26, 2024

Vue version

3.4.21

Link to minimal reproduction

https://play.vuejs.org/#eNp9UctOwzAQ/JWVLy1SHwc4RW2lgnoAIUAUOPmSppvi4tiWH6FVlH9n7fR1QL15Z2Z3Z9YNmxszqgOyjE1cYYXx4NAHM+NKVEZbDw1YLKGF0uoKeiTtccVVoZXz8DV//lzAFJb7aqVln7MEcHZzltS5DEgSGtJXQUqiJuNuE+2gwmNlZO6RKoCJUCZ48HuDU86Kbyx+VnrHGdTDSq9REpgGEpJ5G3CYKkIPiyErc+nOcNxI6Lgbvhb1rGkOltp2Mo5A9HPhgQ2Yd2S9FJvR1mlFh2liM7nRlRES7avxgqJxlkFiIpdLqX+fEhZtDY54SvAPvnUUKqPHm0WHtqZAJ87ndoO+oxfLF9zR+0TSFYIk9RXyHZ2WIXrsZPdBrcn2hS65fUzfK9Tmwy12HpU7hopGo7JNejp4wIcr0c92b0d3qY+rlrV/0cLIbw==

Steps to reproduce

Try to use a symbol for true-value for a checkbox input.

What is expected?

That it works and that v-model gets the symbol value when checkbox is checked.

What is actually happening?

Browser complains that it cannot convert Symbol to a string: Cannot convert a Symbol value to a string.

System Info

No response

Any additional comments?

No response

@mitar
Copy link
Author

mitar commented Mar 26, 2024

To explain the use case here: I have some user supplied values (strings) I use for checkbox values, but I also want to include checkboxes for special system values (like "all", "none", etc.). So that there is no overlap/conflict between strings, I wanted to use Symbols for system values. I could find some other way escape those strings (like a prefix), but Symbols look to me like the perfect solution available in the language for this.

@dadaguai-git
Copy link

dadaguai-git commented Mar 27, 2024

In the compilation process of Vue, Symbol cannot be used as a value. During the compiler's operation, event names, directives, etc., are converted into string form.However, Symbol cannot be converted into a string type.
If the explanation is incorrect, please forgive me.

@LinusBorg
Copy link
Member

If the explanation is incorrect, please forgive me.

It's incorrect, unfortunately.

@dadaguai-git
Copy link

It's incorrect, unfortunately.

I apologize. If possible, could you also share the reason why Symbol cannot be used? I would like to learn more about it.

@sodatea sodatea added ✨ feature request New feature or request and removed ✨ feature request New feature or request labels Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants