1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228
|
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <script src="../statics/vue.min.js"></script> <script src="../statics/vue-router.js"></script> <!-- 引入样式 --> <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css"> <!-- 引入组件库 --> <script src="https://unpkg.com/element-ui/lib/index.js"></script> <style> body { margin: 0; padding: 0; } .header { width: 100%; } .header img { position: absolute; left: 80px; top: -4px; width: 118px; height: 70px; z-index: 999; } .el-menu { display: flex; align-items: center; justify-content: center; } .footer { position: fixed; bottom: 0; left: 0; width: 100%; } .banner_img { width: 100%; height: 480px; }
</style> </head> <body>
<div id="app">
</div>
<template id="header"> <div class="header"> <img src="https://www.luffycity.com/static/img/head-logo.a7cedf3.svg"/> <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal" :router="true"> <el-menu-item v-for="( item, index ) in headerLinks" :index="item.path" :key="index">{{ item.name }}</el-menu-item> </el-menu> </div> </template>
<template id="homeimg"> <el-carousel indicator-position="outside" height="480px"> <el-carousel-item v-for="item in homePageImgArray" :key="item"> <img :src="item.sources" class="banner_img"/> </el-carousel-item> </el-carousel> </template>
<template id="footer"> <div class="footer"> <el-menu class="el-menu-demo" mode="horizontal" background-color="black"> <el-menu-item index="1">关于我们</el-menu-item> <el-menu-item index="2">联系我们</el-menu-item> <el-menu-item index="3">商业合作</el-menu-item> <el-menu-item index="4">帮助中心</el-menu-item> <el-menu-item index="5">意见反馈</el-menu-item> <el-menu-item index="6">新手指南</el-menu-item> </el-menu> </div> </template>
<script> // 如果需要动态绑定属性,必须加上冒号,否则属性后面的值会被当成固定的
let Home = { template: "#homeimg", data() { return { homePageImgArray: [ { sources: ‘https://hcdn1.luffycity.com/static/frontend/index/banner1(4)_1539945492.0492468.png‘, id: 1 }, { sources: ‘https://hcdn1.luffycity.com/static/frontend/index/%E9%AA%91%E5%A3%AB(1)_1539945488.713867.png‘, id: 2 }, { sources: ‘https://hcdn1.luffycity.com/static/frontend/index/banner%203_1538021864.9051478.png‘, id: 3 }, { sources: ‘https://hcdn1.luffycity.com/static/frontend/index/banner11_1538122470.2779157.png‘, id: 4 }, { sources: ‘https://hcdn1.luffycity.com/static/frontend/index/home-banner4_1535545832.4715614.png‘, id: 5 }, ] } } };
let freeCourses = { template: ` <div>这是免费课程页面</div> ` };
let lightCourses = { template: ` <div>这是轻课页面</div> ` };
let degreeCourses = { template: ` <div>这是学位课程页面</div> ` };
let Questions = { template: ` <div>这是智能题库页面</div> ` };
let openCourses = { template: ` <div>这是公开课页面</div> ` };
let innerCourses = { template: ` <div>这是内部教材页面</div> ` };
let pageHeader = { template: "#header", data() { return { activeIndex: "1", headerLinks: [ { path: ‘/‘, name: "首页" }, { path: ‘/free_courses‘, name: ‘免费课程‘}, { path: ‘/light_courses‘, name: ‘轻课‘}, { path: ‘/degree_courses‘, name: ‘学位课程‘}, { path: ‘/questions‘, name: ‘智能题库‘}, { path: ‘/open_courses‘, name: ‘公开课‘}, { path: ‘/inner_courses‘, name: ‘内部教材‘} ], footerLinks: [] } } };
let pageFooter = { template: "#footer", };
let App = { template: ` <div id="app"> <div> <page-header></page-header> </div> <div> <page-footer></page-footer> </div> <router-view></<router<-view> </div> `, components: { ‘page-header‘: pageHeader, ‘page-footer‘: pageFooter, } };
let routes = [ { path: ‘/‘, component: Home }, { path: ‘/free_courses‘, component: freeCourses }, { path: ‘/light_courses‘, component: lightCourses }, { path: ‘/degree_courses‘, component: degreeCourses }, { path: ‘/questions‘, component: Questions }, { path: ‘/open_courses‘, component: openCourses }, { path: ‘/inner_courses‘, component: innerCourses } ];
Vue.use(VueRouter);
let router = new VueRouter({ routes: routes });
new Vue({ el: "#app", template: `<app></app>`, components: { ‘app‘: App, }, router: router, data: {
} })
</script> </body> </html>
|