Comments (6)
Love it as well as the other part of this.
A nice side effect of this approach would be that it solves the problem of naming conflicts when we would introduce new lifecycle hooks in later versions, right?
Right now, in the public discussion about the class API, we are in a back and forth how to namespace lifecycle hooks when using the class API. If we declare lifecycle hooks deprecated, or committed to introducing new hooks as these dynamic lifecylce hooks only, risks of breaking our user's code in the future disappear.
from core.
I don't get why using value instead of state here.
Yes, the fetch example can use state
instead.
For the mouse example, if you return a plain object, x
and y
becomes actual JavaScript values, and they will never update. Then you would have to bind the object like this instead:
data() {
const mouse = useMousePosition()
return {
mouse
}
}
Then access it as mouse.x
and mouse.y
. This works of course, but you'd have to do this even if the function only exposes a single value - which essentially is a ref.
Do the same rule for automatic watcher removal apply to hook listeners?
Lifecycle hooks don't need to be explicitly removed if the component is already unmounted (because they would never fire again)
from core.
I could totally see a babel plugin compiling res =
to res.value =
😸
from core.
I don't get why using value
instead of state
here.
Do the same rule for automatic watcher removal apply to hook listeners?
Everything else looks good!
Regarding replacing lifecycle hooks in class declarations, I don't think we should replace them because it's a less intuitive api
from core.
Published: vuejs/rfcs#23
from core.
in vue2
<Child @hook:mounted="doSomething"></Child>
parent components can listen to its children's’ lifecycle hooks. especially for third-party components.
What should we do in VUE3?
from core.
Related Issues (20)
- vue 3.4.21 :where() style result is not as expected HOT 3
- TypeScript error (TS2590) when defining a prop as a union type of many (> 315) literal values and a non-primitive type
- v-bind shorthand (3.4) does not work with TS + "import * as"
- TypeError: Cannot read properties of null (reading 'parentNode') HOT 5
- Unnecessary re-render happened when using v-model HOT 2
- How to expose the expose method inside the element plus el input component for secondary encapsulation.
- withDefaults type error with tuples HOT 1
- In a Vue template, when writing a for loop and using Chinese variables, the parameter passed to the bound event is always the first value of the array. HOT 1
- Cannot read property 'isCE' of null in host component with slot using Module Federation
- Cannot read properties of undefined (reading 'shapeFlag');Page rendering error HOT 3
- Scoped style escape case
- vue使用tsx突然报 _defineComponent is not defined HOT 8
- a标签使用text属性时, 文本内容会被替换成text的属性值 HOT 2
- defineProps导致热更新失效 HOT 3
- `defineModel` loses two way binding flow when parent adds event listeneres HOT 2
- CSS nesting inserts attribute selector at every level HOT 1
- can not resolve global component in h function when pass a render function HOT 7
- Unhandled error during execution of render function HOT 1
- Regression of multiselect integer form values (>=3.4.15) HOT 2
- v-model修饰符在初始化的时候不生效,只有当v-model绑定的值发生变化时才生效。 HOT 5
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 core.