On the server side with Vuejs, and want to be able to render the page on the server side a number of issues, thank you

Source: Internet
Author: User
Tags php framework php template

Home, I think I'm looking for this should be a critical to rely on the PHP template Rendering page and spa a transition between the plan, I intend to take this step by step changes are tested;
It is also a further reflection on the problem of http://segmentfault.com/q/1010000004067025.

1. Modular or single-file assembly?

    • On the server-side rendered page, using Vue's modular or .vue single-file component to process the data, is the output full HTML? Or will it be uploaded to the client to render?

    • Mainly for the. Vue component, the data from PHP to the window (not directly embedded PHP data), tied to Vue, this will be on the server-side rendering it?

    • Modularity or can embed PHP data directly, that should still output HTML to it?

    • If you give the node layer to render is not directly out of the HTML?

2. Front-end Vue and Template Association method: Multi-blade template or a single blade template (PHP framework laravel Self-template engine)?

    • Render with multiple blade templates, but both contain the same portal, and then each time you call a different component to use, will you pack the extra components together? Is there a better way to do it?

    • Is it possible to render a page using a single blade template rendering, corresponding to multiple portals, and introducing different entrances to each of the different parameters each time?

The problems of 1 and 2 will go together, and the inside can cross, which is the better solution?

Thank you! May be a bit messy, want to try this transition plan concrete implementation of the scheme.

Reply content:

Home, I think I'm looking for this should be a critical to rely on the PHP template Rendering page and spa a transition between the plan, I intend to take this step by step changes are tested;
It is also a further reflection on the problem of http://segmentfault.com/q/1010000004067025.

1. Modular or single-file assembly?

    • On the server-side rendered page, using Vue's modular or .vue single-file component to process the data, is the output full HTML? Or will it be uploaded to the client to render?

    • Mainly for the. Vue component, the data from PHP to the window (not directly embedded PHP data), tied to Vue, this will be on the server-side rendering it?

    • Modularity or can embed PHP data directly, that should still output HTML to it?

    • If you give the node layer to render is not directly out of the HTML?

2. Front-end Vue and Template Association method: Multi-blade template or a single blade template (PHP framework laravel Self-template engine)?

    • Render with multiple blade templates, but both contain the same portal, and then each time you call a different component to use, will you pack the extra components together? Is there a better way to do it?

    • Is it possible to render a page using a single blade template rendering, corresponding to multiple portals, and introducing different entrances to each of the different parameters each time?

The problems of 1 and 2 will go together, and the inside can cross, which is the better solution?

Thank you! May be a bit messy, want to try this transition plan concrete implementation of the scheme.

First, Vue is the client,
If you want to render Vue on the server,
It's not going to work, you have to go through Nodejs.
There are no officially recommended mature programs.

laravel+ vue is essentially:
laravelbladerendering the HTML through the engine,
Returns the appropriate script to be executed for vue the client.

To solve is vue not itself or inconvenient路由和权限验证

Using Node+vue.js to implement SPA applications, solving the biggest drawbacks of spa applications SEO before writing the article is now in the perfect project.

The. vue file does not load on the server so it is discarded.
Server-side rendering can be written with a 3rd party Vue-server plugin

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.