会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132441个问题
JAVA 全系列/第四阶段:网页编程和设计/HTML5(旧) 18781楼

老师我跟着视频走为什么里面路由可以跳转但是页面上内容不显示呢。视频进行到一半的时候应该显示的首页,和用户中心等字样一个没出来,麻烦老师帮忙看看


main.js

import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import VueRouter from 'vue-router'

import Home from "./pages/Home.vue"
import User from "./pages/User.vue"

Vue.use(VueRouter)

Vue.config.productionTip = false

/**
 * 定义路由,路由配置
 */
const routers = [
  {
    path:"/",
    component:Home
  },
  {
    path:"/user/:userid/:name",
    component:User
  }
]

/**
 * 创建路由对象,将路由配置塞到路由对象当中
 */
const router = new VueRouter({
  routers
})

/**
 * 挂载路由,将路由对象挂载到vue实例当中
 */



/**
 * Vue实例
 */
new Vue({
  router,
  render: h => h(App),
}).$mount('#app')

App.vue

<template>
  <div id="app">
    <router-link to="/">首页</router-link>  |
    <router-link to="/user/10001/iwen">用户</router-link>
    <router-view></router-view>
    
  </div>
</template>

<script>


export default {
  name: 'App',
  components: {
    
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>

Home.vue

<template>
  <div>
      <h3>首页</h3>
  </div>
</template>

<script>
export default {

}
</script>

<style>

</style>

User.vue

<template>
    <div>
        <h3>用户中心:{{ $route.params.userid }} - {{ $route.params.name }}</h3>
    </div>
</template>

<script>
export default {

}
</script>

<style>

</style>


点击按钮有跳转路由就是不显示内容

image.png


JAVA 全系列/第十八阶段:亿级高并发电商项目_架构/编码(旧)/Vue框架 18782楼

Desktop.rar

    image.png    image.png

为什么添加元素只添加第一个、第二个、和最后一个啊?

是哪里的问题啊?

JAVA 全系列/第二阶段:JAVA 基础深化和提高/数据结构 18783楼
Python 全系列/第十五阶段:Python 爬虫开发/爬虫基础 18789楼
Python 全系列/第二阶段:Python 深入与提高/文件处理 18792楼

老师,请问为什么我的页面一直加载不出来? 我用的是macOS。



index.html

在这个路径下面。

/Users/kevinlu/Desktop/JAVA_Lesson/5_JavaEE/3_Servlet


server.xml:

部分代码,最后三行是我修改的,全部可以看附件。

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true">

        <!-- SingleSignOn valve, share authentication between web applications
             Documentation at: /docs/config/valve.html -->
        <!--
        <Valve className="org.apache.catalina.authenticator.SingleSignOn" />
        -->

        <!-- Access log processes all example.
             Documentation at: /docs/config/valve.html
             Note: The pattern used is equivalent to using pattern="common" -->
        <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
               prefix="localhost_access_log" suffix=".txt"
               pattern="%h %l %u %t &quot;%r&quot; %s %b" />
</Host>
	  
<Host name="www.itbz.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
    <Context path="/itbz" docBase="/Users/kevinlu/Desktop/JAVA_Lesson/5_JavaEE/3_Servlet"/>
</Host>


修改Host文件:

terminal -> sudo nano /private/etc/hosts

image.png

访问页面:

Tomcat启动成功,可以通过localhost:8888访问到主页面

但是访问

Archive.zip

www.itbz.com:8888/itbz/index.html 这个地址就不成功,界面是空的

image.png

JAVA 全系列/第五阶段:JavaWeb开发/Servlet技术详解(旧) 18793楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637