VueJS 3 - refs的shallowReactive对象中的无关引号
我有,非常充分的理由与这个问题完全无关,一个由单独的字符串引用组成的shallowReactive对象。
const selections = shallowReactive({});
selections[i] = ref("Literally any string");
<一href="https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8ZGl2PlxuICAgIDxkaXYgdi1mb3I9XCIoc2VsLCBpKSBpbiBzZWxl Y3Rpb25zXCIgOmtleT1cImlcIj5cbiAgICAgIHt7IHNlbCB9fVxuICAgIDwvZGl2PlxuICA8L2Rpdj5cbjwvdGVtcGxhdGU+XG5cbjxzY3JpcHQ+XG5pb XBvcnQgeyByZWYsIHNoYWxsb3dSZWFjdGl2ZSB9IGZyb20gXCJ2dWVcIjtcbmV4cG9ydCBkZWZhdWx0IHtcbiAgc2V0dXAoKSB7XG4gICAgY29uc3Qgc2 VsZWN0aW9ucyA9IHNoYWxsb3dSZWFjdGl2ZSh7fSk7XG5cbiAgICBsZXQgaSA9IDA7XG5cbiAgICBzZXRJbnRlcnZhbCgoKSA9PiB7XG4gICAgICBzZWxl Y3Rpb25zW2ldID0gcmVmKFwiTmV3IHN0cmluZ1wiKTtcbiAgICAgIGkrKztcbiAgICB9LCAyMDAwKTtcblxuICAgIHJldHVybiB7XG4gICAgICBzZWxlY 3Rpb25zLFxuICAgIH07XG4gIH0sXG59O1xuPC9zY3JpcHQ+XG5cbjxzdHlsZSBzY29wZWQ+XG5pbWcge1xuICB3aWR0aDogMjAwchHg7XG59XG5oMSB7XG 4gIGZvbnQtZmFtaWx5OiBBcmlhbCwgSGVsdmV0aWNhLCBzYW5zLXNlcmlmO1xufVxuPC9zdHlsZT4iLCJpbXBvcnQtbWFwLmpzb24iOiJ7XG4gIFwiaW1 wb3J0c1wiOiB7XG4gICAgXCJ2dWVcIjogXCJodHRwczovL3NmYy52dWVqcy5vcmcvdnVlLnJ1bnRpbWUuZXNtLWJyb3dzZXIuanNcIlxuICB9XG59In0=" rel="nofollow noreferrer">我在这里有一个工作示例。
这些引号不在模板或字符串本身中,我必须偶然发现shallowReactive和/或ref的一些奇怪行为。我知道这不是典型的 Vue 模式。我希望有人理解为什么会发生这种情况并可以分享他们的知识。
I have, for very good reasons completely irrelevant to this this question, a shallowReactive object comprised of individual string refs.
const selections = shallowReactive({});
selections[i] = ref("Literally any string");
I have a working example here.
These quotes are not in the template or the string itself, I have to have stumbled onto some weird behavior with shallowReactive and/or ref. I understand this is not a typical Vue pattern. I'm hoping someone understands why this is happening and can share their knowledge.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论