简体   繁体   English

将Vue.js添加到现有的非单页应用程序

[英]Add Vue.js to existing non-single page application

I have a CMS backed web site where Vue.js was added to handle a UI feature of the site. 我有一个由CMS支持的网站,其中添加了Vue.js来处理该网站的UI功能。 The feature has tabs that switch content on the page. 该功能的选项卡可切换页面上的内容。 I need to make the tabs deep linkable as in there needs to be a way to have a certain tab set as active on page load. 我需要使这些选项卡可深度链接,因为需要一种方法来将某个选项卡设置为在页面加载时处于活动状态。 I can easily achieve this using a URL has but I would like to see if I can just use the Vue.js router. 我可以使用URL轻松实现这一点,但是我想看看是否可以使用Vue.js路由器。 I haven't been able to find any resources to add the router to an existing site that isn't fully powered by Vue.js. 我无法找到任何资源将路由器添加到Vue.js尚未完全支持的现有站点。

Is there way to add vue-router without any additional server configuation? 是否可以在不进行任何其他服务器配置的情况下添加vue-router?

You could use Vue Router in the hash mode for history. 您可以在哈希模式下将Vue Router用于历史记录。 Your URL would end up being something like www.example.com/post/1#tab1 and www.example.com/post/1#tab2 . 您的URL最终将类似于www.example.com/post/1#tab1www.example.com/post/1#tab2

One caveat, if SEO is important to this site, then you would need to do the routing on the server to make the page easier to crawl by Google. 请注意,如果SEO对于此站点很重要,则您需要在服务器上进行路由,以使页面更容易被Google抓取。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 vue.js - 组织具有多个视图的大型单页面应用程序 - vue.js - Organize big single page application with multiple views Vue.js 在现有应用程序上的电子 - Vue.js over electron on an existing application Vue.js将对象添加到现有数组 - Vue.js add objects to existing array Nuxt.js static 站点与使用 Vue.js 的动态单页应用程序? - Nuxt.js static site with a dynamic single page application using Vue.js? 如何使用Identity Server 4保护Asp.net核心2.1和Vue.js单页面应用程序 - How to protect Asp.net core 2.1 and Vue.js single page application with Identity Server 4 重新加载vue.js单个应用程序时出现错误,请参见vue.js代码 - i have error see vue.js code when reload vue.js single application 如何在 Vue.JS 中将现有组件添加到模板 onclick? - How to add an existing component to a template onclick in Vue.JS? 如何在 Vue.js 和 Firebase 中向现有用户添加新数据 - How to add new data to existing user in Vue.js and Firebase 如何将 position 添加到 javascript / Vue.js 中的现有阵列? - How to add position in order to existing array in javascript / Vue.js? 当您不构建单页应用程序时,如何构建 Vue.js 单文件组件并导入它们? - How do you build Vue.js single file components and import them when you're not building a single page application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM