current position:Home>Web front-end development technology: Vue routing
Web front-end development technology: Vue routing
2023-01-25 11:21:01【nickdlk】
一、实验目的:
掌握VueRouting related knowledge and application.
二、实验要求:
了解VueRouting related knowledge and related plug-ins、loader的安装与使用
编写程序完成以下实验内容并上交实验报告
三、实验内容:
(一)实验基础
1、.vue文件
.vue文件又叫"单文件组件",Is a style that can be put、逻辑、Templates are written in a file,独立发布、A manageable format.This format needs to be passedwebpack进行处理.
.vueThe file contains three types of top-level language blocks <template>, <script> 和 <style>.这三个部分分别代表了 html、js、css.其中 <template> 和 <style> It supports writing in precompiled languages,If used in the projectscss 预编译,则
.vueFiles may be read as includesHtml、JavaScript、CSS的网页文件,It's just that the native web page file is interpreted and executed,而.vueThe file needs to be compiled and executed.
2、This experiment mainly imitates the textbook“5.3.3 代码实现”Implementation steps in section ,初步掌握VueRouting related knowledge and application methods.
(二)实验题
请使用VueRouting related knowledge is implemented manuallyTab栏切换案例,要求如下.
①创建一个components/Message.vue组件,用来展示页面内容.
②创建3个子路由,分别是“待付款”、“待发货”、“待收货”页面,Write the corresponding content separately on each sub-routing page,页面效果如图所示.
四、设计思路:
创建一个Vue工程,添加vue-router.
创建一个Message.vue,作为主页面,Also used as a jump.
创建view文件夹,放“待付款”、“待发货”、“待收货”页面.
编写router/index.js路由文件.
五、实验过程中遇到的问题及解决手段:
vue-router安装出现问题,解决:使用vue-cliScaffolding creates engineering projects.
六、程序源代码:
Message.vue:
<template>
<div id="app">
<div id="nav">
<router-link to="/">待付款</router-link> |
<router-link to="/about">待发货</router-link> |
<router-link to="/receive">待收货</router-link>
</div>
<router-view/>
</div>
</template>
<style> #app {
font-family: 'Avenir', Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-align: center; color: #2c3e50; } #nav {
padding: 30px; } #nav a {
font-weight: bold; color: #2c3e50; } #nav a.router-link-exact-active {
color: #42b983; } </style>
src\message\views\obligation.vue:
<template>
<div class="home">
<h1> Items pending payment </h1>
</div>
</template>
<script> // @ is an alias to /src export default {
name: 'home', components: {
}, } </script>
src\message\views\receive.vue:
<template>
<h1> Items awaiting delivery </h1>
</template>
<script> export default {
name: "receive" } </script>
<style scoped> </style>
src\message\views\ToBeDelivered.vue:
<template>
<div class="delivered">
<h1> Items pending shipment </h1>
</div>
</template>
src\message\router\index.js:
import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/obligation.vue'
Vue.use(VueRouter)
const routes = [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/about',
name: 'about',
component: () => import('../views/ToBeDelivered.vue')
},
{
path: '/receive',
name: 'receive',
component: () => import('../views/receive.vue')
}
]
const router = new VueRouter({
routes
})
export default router
文件目录:
copyright notice
author[nickdlk],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2023/025/202301251105496851.html
The sidebar is recommended
- Based on VirtualBox centos7 virtual machine installation
- JVM process cache - Caffeine
- Code Caprice No24 | Backtracking Algorithm Theoretical Basis, 77. Combination
- The Road to Algorithm Practice——[String] Leetcode 824 Goat Latin
- Git summary - Prompt to submit or temporarily store changes when switching to a branch
- Productivity tools - [gitlab configuration] One-time configuration of GitLab account
- Echo+Vue+ElementUI management background source code
- Revel+Vue+ElementUI framework use and build tutorial
- Basic practice tutorial of Revel+Vue+ElementUI framework
- Go Web Development Revel+Vue+ElementUI Framework Practical Tutorial
guess what you like
Construction and deployment tutorial of Revel+Vue+ElementUI framework
8. Java loop advanced comprehensive exercises - infinite loop and jump control statement, every seven passes, square root, judging whether it is a prime number, guessing number games
Control statement + exception handling perfect lucky draw applet-java basics
9. Java Array Knowledge Encyclopedia
Lucky draw applet-java basics
Java basic implementation calculator applet
The front end of actual combat: copy write millet's official website on the first day
1. Linux application programming and network programming---file IO notes in Linux system
7. Linux application programming and network programming --- thread full solution Notes
[Front-end notes - CSS] 10. Cascading and inheritance + selector
Random recommended
- 8. Linux application programming and network programming---Linux network programming notes
- [Java|golang] 1828. Count the number of points in a circle
- Add environment variables under Linux system and will not overwrite the previous method of adding environment variables
- 2 · Linux application programming and network programming - file attributes notes
- Redis interview questions (classic 7 questions)
- [Front-end notes——CSS] 11. Box model + background and border
- C + + large Numbers together, according to a combined
- 3. Linux application programming and network programming --- get system information notes
- The use and principle of Kafka message queue
- 5. Linux application programming and network programming---signal notes in Linux
- 6 · Linux application programming and system programming - senior IO notes
- Java collection common interview questions (4)
- 072-JAVA project training: Imitation QQ instant messaging software series lecture 7 (explaining the realization of the chat interface and functions)
- Coordination center performance comparison: how zookeeper solves the load balancing problem
- 070-JAVA project training: imitation QQ instant messaging software series lecture five (explain user registration function)
- Ubuntu installation and configuration (brief)
- 073-JAVA project training: imitation QQ instant messaging software series lecture eight (explain query and add friend function)
- SQL injection classification and error injection EXP
- All basic commands in linux fail, showing that the command cannot be found
- 4. Linux application programming and network programming---Linux process full solution notes (difference between process and program)
- Linux system - basic IO
- Hanlp's understanding of user-defined dictionaries (java version)
- Brief description and configuration of Maven
- 071-JAVA project training: imitation QQ instant messaging software series lecture six (explaining the function of QQ main interface)
- 【Maximum LeetCode】January Algorithm Training (12) Linked List
- 【Max LeetCode】January Algorithm Training (13) Doubly Linked List
- [Big Data Management] Java implements Bloom filter
- [Maximum LeetCode] Algorithm training in January (14) stack
- [Machine Learning] Adaboost Integrated Algorithm
- [Big Data Management] Java implements cuckoo filter (CF)
- Chaozhou Xiangqiao: "Charming Ancient City, Cultural Sharing" Spring Festival Intangible Cultural Heritage Market Opens
- [Big data management] Java realizes the dictionary tree TireTree
- [Max LeetCode] January Algorithm Training (11) Matrix
- New Express (Web framework based on HTTP module encapsulation NodeJS)
- JavaScript error-prone questions (stack processing, call function, prototype chain questions)
- Space "travel", lion and crane dance, intangible cultural heritage experience...During the Spring Festival, Zhuhai Jinwan is so fun!
- Wine 8.0 official release: better support for running Windows applications on Linux and other systems
- Zhongke Sugon: Sugon's new computer "participates in" "The Wandering Earth 2"
- Linux actual combat notes finishing (1.24)
- Automatically execute the specified sql when the springBoot project starts