【问题标题】:Problems finding links in the navigation bar in vue js whith router在带有路由器的vue js导航栏中查找链接的问题
【发布时间】:2020-05-12 23:00:23
【问题描述】:

当我启动生产服务器时,出现以下错误:

“_omappvp”cookie 很快就会被拒绝,因为“sameSite”属性设置为“none”或无效值,没有“secure”属性。有关“sameSite”属性的更多信息,请参阅https://developer.mozilla.org/docs/Web/HTTP/Cookies

我也按下关于菜单中的项目,一切正常,但如果我在地址栏中写 www.miosito.it/about 给我错误 404 page not found

路由器配置文件为:

import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from './views/Home.vue'
import Admin from './views/Admin.vue'
import Notfound from "./components/404.vue";
import Overview from "./views/Overview.vue";
import Profile from "./views/Overview.vue";
import Products from "./views/Products.vue";
import  Orders from "./views/Overview.vue";

import  Preload from "./components/Preload2.vue";

//import  About from "./components/unity.vue";

//import Products from "./views/Products.vue";
import {fb} from './firebase'

Vue.use(VueRouter)
const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes:
   [
  {
    path: '/',
    name: 'Home',
    component: Home
  },

  {
    path: '*',
    name: 'Notfound',
    component: Notfound
  },

  {
    path: '/preload',
    name: 'Preload',
    component: Preload
  },


  {
    path: '/admin',
    name: 'admin',
    component: Admin,
    meta: { requiresAuth: true },
    children:[
      {
        path: "overview",
        name: "overview",
        component: Overview
      },

      {
        path: "Products",
        name: "Products",
        component: Products
      },

      {
        path: "profile",
        name: "profile",
        component: Profile
      },
   
      {
        path: "orders",
        name: "orders",
        component: Orders
      },

     
      
    ]


  },
 

  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ './views/About.vue')
  },

  {
    path: '/lavori',
    name: 'Lavori',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ './views/Lavori.vue')
  }
  

]


})

router.beforeEach((to, from, next) => {

  const requiresAuth = to.matched.some(x => x.meta.requiresAuth)
  const currentUser = fb.auth().currentUser

  if (requiresAuth && !currentUser) {
      next('/')
  } else if (requiresAuth && currentUser) {
      next()
  } else {
      next()
  }
})

export default router
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.5/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>

在导航栏引导程序中,我以这种方式调用链接

  <li class="nav-item">
              <router-link to="/about" class="nav-link" href="#">About</router-link>
            </li>

我的网络空间在以下服务器“000webhost”上

www.000webhost.com

我应该怎么做才能启用在栏中写入地址的功能并解决错误? 本地主机可以正常工作并且没有检测到错误。 提前致谢

【问题讨论】:

    标签: node.js vue.js npm-install router


    【解决方案1】:

    我安装的包的版本如下:

    {
      "name": "vue-shop",
      "version": "0.1.0",
      "private": true,
      "scripts": {
        "serve": "vue-cli-service serve",
        "build": "vue-cli-service build",
        "lint": "vue-cli-service lint"
      },
      "dependencies": {
        "@babylonjs/core": "^4.1.0",
        "@babylonjs/loaders": "^4.1.0",
        "@hapi/cryptiles": "^5.0.0",
        "babel-core": "^6.26.3",
        "bootstrap": "^4.4.1",
        "bootstrap-vue": "^2.13.0",
        "core-js": "^3.6.4",
        "firebase": "^7.14.2",
        "jquery": "^3.4.1",
        "materialize-css": "^1.0.0-rc.2",
        "node-ipc": "^9.1.1",
        "parse5": "^2.1.0",
        "popper.js": "^1.16.1",
        "run": "^1.4.0",
        "serve": "^11.3.0",
        "vue": "^2.6.11",
        "vue-babylonjs": "^1.0.0-beta.7",
        "vue-fire": "^0.1.0",
        "vue-router": "^3.1.6",
        "vue-simple-alert": "^1.1.1",
        "vue-unity-webgl": "^1.2.0"
      },
      "devDependencies": {
        "@vue/cli-plugin-babel": "~4.3.0",
        "@vue/cli-plugin-eslint": "~4.3.0",
        "@vue/cli-plugin-router": "~4.3.0",
        "@vue/cli-service": "~4.3.0",
        "babel-eslint": "^10.1.0",
        "eslint": "^6.7.2",
        "eslint-plugin-vue": "^6.2.2",
        "sass": "^1.26.3",
        "sass-loader": "^8.0.2",
        "vue-template-compiler": "^2.6.11"
      }
    }
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/d3/5.7.0/d3.min.js"&gt;&lt;/script&gt;

    我安装的包的版本如下:

    你知道这个问题是怎么解决的吗? 非常感谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-20
      • 2023-02-06
      • 2019-07-28
      • 2017-08-09
      • 2021-11-22
      • 2019-02-09
      相关资源
      最近更新 更多