i am developing a vujs based museum installation with several clients and one server. I would like to develop the two apps, client and server, in one application.
when calling the url I want to read out the parameters.
https://example.com/mode=client&id=1 or mode=server
then I want to load different root components with creatapp
if server .. const app = Vue.createApp(serverComponent)
if client ... const app = Vue.createApp(serverComponent)
is that a good way?
if so, how can I pass the clientID directly into the root component
EDITED its simple to pass props to the root component with Vue.createApp(clientComponent, {id:id,...})
but currently I fail to choose between 2 different root components. following setup
import App from './App.vue'
import AppServer from './AppServer.vue'
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const mode = urlParams.get('mode')
if (mode == "server"){
let app = createApp(AppServer);
} else {
let id = urlParams.get('id')
app = createApp(App, { id: parseInt(id) } );
}
but let app = createApp(AppServer); throws an error. app never initialised