有什么方法可以使用Vue 3路由器路由到html文件吗?

问题描述 投票:0回答:1

我正在使用Vue 3。我需要将登陆页面静态html页面链接到主路由

/
,这与vue 3原始
index.html
完全不同。 HTML 文件包含大量第 3 方 CDN 样式表和脚本。我如何在与使用 vue 3
index.html
完全不同的任何路线上加载静态 html 页面?

javascript vue.js vuejs3
1个回答
0
投票

是的,您可以这样做,前提是您的登陆页面位于 public/landing.html 中。然后,在 router/index.js:

 routes: [
{
 path: '/',
 name: 'root',
 component: LandingView
 }, //... rest of routes

然后在LandingView.vue

<template></template>

<script setup>
location.href = '/landing.html'
</script>

<style></style>
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.