[英]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#tab1
和www.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.