Currently, we try to figure out, how we can structure our vue code for this use case:
routing will be handled by the backend, so basically we don't creating an SPA here
we want to use vue to replace some jquery plugins. So on some sites of our website we have e.g. a drop-down component or a date picker component ...
one site will be small SPA
on each site, we have a navigation, where we also want using vue
How should this be structured? Is it one big vue application?
My idea is to build two vue applications:
one for the small SPA
one for all the components we need on different sites
Anybody can help out here?
For developing SPA in vuejs. Please refer to these two links
https://github.com/vuejs/vue-cli
and
https://github.com/chrisvfritz/vue-2.0-simple-routing-example
And for integerating VueJS in existing web page
you can follow the official website of vuejS
Related
We have a CMS where we are trying to provide the support of VueJS framework to our client websites. The views and their logic will be coded from the CMS Panel itself. The problem comes when trying to render the website having the support for both SPA and SSR due to SEO.
When client requests for a page, the SSR should work during that time but once the page is rendered, the SPA should take the control and let the user navigate(vue-router) wihtout page reload as it works in Vue SPA.
I checked on with this question and it won't help due to my unique requirement. There are no static bundles available for my case.
Any help will be appreciated!
I have tried many examples to achive this however they aren't exactly helping for my case.
https://github.com/0x00000001A/vuejs-spa-ssr-vuex
https://github.com/shenron/vue3-example-ssr
You may need nuxtjs. It can help you spa+ssr on vue
I have developed a small App in VueJs and now I want to integrate this app into another website. I know there are ways using iframe/embed, but I need something similar to Google analytics code, meaning it just gives us few lines of JS code and it does all the trick.
Is it possible to create a JS code, add it to another website, and that website start displaying my VueJs application serving from another host?
I created a Vue.js app without using Vue CLI, so that means I did everything from scratch including setting up Webpack 4. The reason I did this was because I don't like the idea of frameworks concealing the inner workings of things so that I can't fix things myself.
As an SPA, I have got the basic demo site working with an Home and About view. But I am looking to create a multi-page app with Express. The only information on multi-page Vue.js apps seems to be linked to the pages option that only comes with Vue CLI (see here)
Is there a way to have a multi-page app for projects created without Vue CLI?
Sure, you could handle routing with Express and have the page rendered server-side.
You can use Vue official package for routing, vue-router and choose between SSR (server-side rendering) or client side.
I suggest you to check this official doc about it: https://ssr.vuejs.org/
I came across vuexpress, vuepress and vue-server-renderer. To me these are looking somewhere similer which I guess are not. I am not frontend developer so not able to understand exact difference and use of these three modules.
Their official sites are saying
https://github.com/vuexpress/vuexpress
vuexpress: Vue + Express.js = VueXpress / A server side rendering
engine for Express.js. Use .vue files as your express.js templates.
https://vuepress.vuejs.org/
VuePress: Vue-powered Static Site Generator
https://ssr.vuejs.org/
vue-server-renderer: server-rendered Single-Page Applications using
Node.js as the server.
vuepress and vue-server-renderer are official library from Vue.js
So what exactly are differences and use of these three modules?
The idea with Vue (from the perspective of your question) is that you create a single-page application.
vuexpress is a rendering engine you can use in an Express application if you want to use the Vue syntax to implement your Express views, i.e. you implement a dynamic website and use the Vue syntax.
vuepress is about building a single-page application in Vue that also prerenders each page (and some other goodies, such as using markdown) to improve initial page load and facilitate for search engines. It is primarily used for websites with static content, such as documentation.
The point with a Vue application is to run it on the client (in the web browser). With vue-server-renderer you can run it on the server to obtain the HTML code the web browser would render if it would run in the web browser, and send it to the web browser, so the web browser doesn't need to run your Vue application, but receives the HTML it would display instead. Why? To improve initial page load and facilitate for search engines. I imagine vuepress makes use of vue-server-renderer under the hood.
I am new to Vue and I have already migrated a small application to it, but now I wanted to add routing in the front end level, so I started looking at vue-router.
My components use inline-template because they are placed inside templates of a django application. This way, the django ecosystem takes care of the localization and also offers more information to logged-in users.
I could not find a way to make my components work with vue-router. I even tested using x-templates and it just does not work unless the template is a string inside the JS code.
Is it possible for vue-router to use external file templates? If not, how does vue-router handle the situation where templates are generated by a backend server?
I eventually found how to make it work. The trick was to place the x-templates outside the root Vue app element. This way the root Vue app did not tried to render them and then they were rendered by their components.