来自上海的这位朋友 2022-08-30 23:11 采纳率: 50%
浏览 91
已结题

请求中默认没有正常返回页面

我当前vue项目中
我当前页面是可以正常访问的,没有问题,如图:

img

但是,为什么第一个请求请求不到页面
We're sorry but 项目名称 doesn't work properly without JavaScript enabled. Please enable it to continue.
搜索大量资料,有的说把配置nginx,但我这是本地环境

目前问题如图:

img

我期望效果类似于百度这样 能把页面请求回来
如图:

img

main.js文件代码

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import axios from "@/axios";
import * as echarts from 'echarts'
import auth from './authentication'
import VueClipboard from 'vue-clipboard2'

Vue.use(VueClipboard)
Vue.config.productionTip = false
Vue.prototype.$http = axios
Vue.prototype.$echarts = echarts

Vue.config.productionTip = false
new Vue({
  router,
  render: h => h(App),
  components:{
    App
  }
}).$mount('#app')

router.js文件代码

import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login/index'
import desktop from '../components/desktop/index'
import components from '../router/components'
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'login',
    component: login
  }
]


const router = new VueRouter({
  routes,
  mode: 'hash'
})

router.beforeEach((to,from,next)=>{
  if(to.path === '/'){
    return next()
  }
  let token = localStorage.getItem("token");
  if (!token){
    return next("/")
  }
  next()
})

export default router
  • 写回答

3条回答 默认 最新

  • Z_pigeon 2022-08-30 23:21
    关注

    接口响应虽然如此,但是不影响功能才对。目前是遇到什么难题所以需要修改这里吗

    评论

报告相同问题?

问题事件

  • 已结题 (查看结题原因) 8月31日
  • 创建了问题 8月30日

悬赏问题

  • ¥20 python爬虫遇到空文本取不出来
  • ¥15 x264库中预测模式字IPM、运动向量差MVD、量化后的DCT系数的位置
  • ¥15 curl 命令调用正常,程序调用报 java.net.ConnectException: connection refused
  • ¥20 关于web前端如何播放二次加密m3u8视频的问题
  • ¥15 使用百度地图api 位置函数报错?
  • ¥15 metamask如何添加TRON自定义网络
  • ¥66 关于川崎机器人调速问题
  • ¥15 winFrom界面无法打开
  • ¥30 crossover21 ARM64版本安装软件问题
  • ¥15 mymetaobjecthandler没有进入