Comments (6)
I was studying the source-dom mapping techniques and noticed Johnson's vue-preview (previously @volar/preview) https://twitter.com/johnsoncodehk/status/1507024137901916161 is also using a similar solution of using vNode* events https://github.com/johnsoncodehk/vue-preview/blob/master/packages/core/bin/vite.js#L35, so this approach is promising.
from vite-plugin-vue-inspector.
I was studying the source-dom mapping techniques and noticed Johnson's vue-preview (previously @volar/preview) https://twitter.com/johnsoncodehk/status/1507024137901916161 is also using a similar solution of using vNode* events https://github.com/johnsoncodehk/vue-preview/blob/master/packages/core/bin/vite.js#L35, so this approach is promising.
Thanks for the reference and suggestion· We actually discussed it with the team before, I think we need to rehash this and resolve it.
from vite-plugin-vue-inspector.
This is a current implementation limitation. We injected a data-v-inspector
attribute into the element.If we turn on injection for the component
nodes, it'll affects the injection of root element inside the component.This is a point of conflict, i'll thinking about and choose one, it depends on which one is more helpful to the developer.
By default, everything in $attrs will be automatically inherited on the component's root element if there is only a single root element. (https://vuejs.org/api/component-instance.html#attrs)
from vite-plugin-vue-inspector.
@webfansplz , how about using onVnodeMounted instead, I guess it doesn't fall-through, in fact, in the rendered dom, the attributes won't show up at all (and shall be clean) if the mapping is maintained elsewhere, for eg, a windows object.
<template>
<PrimeDropdown
v-model="appStore.locale"
:options="locales"
:onVnodeMounted="pgUpdateElCache(/* file, line no, pos */)" // Maintain the source-dom mapping on some windows object
/>
</template>
Usage references:
https://v3-migration.vuejs.org/breaking-changes/vnode-lifecycle-events.html#_3-x-syntax
vuejs/core#5219 (comment)
https://juejin.cn/post/7174568239903539236
vuejs/core#2969 (comment)
vuejs/core#4345 (comment)
If this is a potential solution, then the next challenge is how to handle & avoid duplicate usage of onVnodeMounted (or @vue:mounted
), if the user by any chance have already used it.
from vite-plugin-vue-inspector.
Curious to know the outcome, thanks :-)
from vite-plugin-vue-inspector.
+1
from vite-plugin-vue-inspector.
Related Issues (20)
- "Unexpected token, expected jsxTagEnd" error when processing self closing tags in JSX files HOT 2
- Windows vscode remote usage HOT 1
- Doesn't work if Vite has a base configured HOT 3
- 定位不到有关业务文件
- vite+vue3项目不生效 HOT 6
- Hide in Vue devtools
- load.js 404 not found
- 添加长按触发的功能
- Support for docker containers HOT 1
- 挂了代理后,mac:net::ERR_ABORTED 502 (Bad Gateway) HOT 1
- .vue file includes decorators, compile error HOT 1
- toggleEventListener runtime error
- 点击后自动关闭功能选择模式的功能
- "Illegal tag name. Use '<' to print '<'." In Nuxt3+pug HOT 2
- Support `decorators-legacy` and `importAttributes` in TypeScript
- Opens nano even VUE_EDITOR is set to phpstorm HOT 7
- Replace error
- (Feature Request) Add a configuration option to support adding the data-v-inspector attribute to components
- Can't use the "Open in editor" feature. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vite-plugin-vue-inspector.