-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
feat: createApp support lifetimes hooks #10995
Comments
import { creatApp, h } from 'vue'
import App from 'App.vue'
const app = createApp({
onMounted() {
// do what you need here
},
render: () => h(App)
}) |
@LinusBorg,This is a solution I didn't expect, thanks, but I have one more question。 ![]() when |
That would depend on the implementation of that component. Seems that it rendered nothing, maybe because of a v-if? I cant tell without seeing it |
I will give you a warehouse address later. Are you interested in helping track it down? |
Have you checked that |
Vue version
v3
Link to minimal reproduction
vue ceateApp api
Steps to reproduce
What is expected?
When we use createApp, I have no way of knowing when append is called on my element, because I may need to operate or obtain information at that time, in the upper layer, instead of defining onMounted in the App component.
![image](https://private-user-images.githubusercontent.com/57086651/333019633-33942bfb-0dc3-4013-9b09-8609cc67705d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkxMDMwMjYsIm5iZiI6MTcxOTEwMjcyNiwicGF0aCI6Ii81NzA4NjY1MS8zMzMwMTk2MzMtMzM5NDJiZmItMGRjMy00MDEzLTliMDktODYwOWNjNjc3MDVkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIzVDAwMzIwNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlmOTY5OTBiZTk1ZjdiOTBkNjAyMDNkYmU4NjdjZjFmNzE0NDUzMGI4YzdjODIyNDAxY2VlZDdhMWEwNjQ0ODUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.eHU-QBwxRYZkiIAQCOWdYTz00VVMJ_U-3J97TFaynvQ)
I know that this modification of the parameters of the existing createApp may be a destructive change. If a new api is provided, such as createNewApp, it can be designed like this. Or there is a better design to make it easier to extend
What is actually happening?
createApp just accept props
System Info
No response
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: