feat(daily recipe / week recipe page): [M] 使用 <router-link> 代替 <a> 减少页面跳转时间

[M] 使用 <router-link> 代替 <a> 减少页面跳转时间

Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
Ching 2021-10-05 17:27:41 +08:00
parent d564584e07
commit 1fa790a185
11 changed files with 83 additions and 64 deletions

View File

@ -1 +1 @@
<!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>frontend</title><link href="/css/app.6a1f0595.css" rel="preload" as="style"><link href="/css/chunk-vendors.8823d44d.css" rel="preload" as="style"><link href="/js/app.1c393e48.js" rel="preload" as="script"><link href="/js/chunk-vendors.d85c1184.js" rel="preload" as="script"><link href="/css/chunk-vendors.8823d44d.css" rel="stylesheet"><link href="/css/app.6a1f0595.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.d85c1184.js"></script><script src="/js/app.1c393e48.js"></script></body></html> <!DOCTYPE html><html lang=""><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><link rel="icon" href="/favicon.ico"><title>frontend</title><link href="/css/app.6a1f0595.css" rel="preload" as="style"><link href="/css/chunk-vendors.8823d44d.css" rel="preload" as="style"><link href="/js/app.f7e1e662.js" rel="preload" as="script"><link href="/js/chunk-vendors.bb844861.js" rel="preload" as="script"><link href="/css/chunk-vendors.8823d44d.css" rel="stylesheet"><link href="/css/app.6a1f0595.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but frontend doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.bb844861.js"></script><script src="/js/app.f7e1e662.js"></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
frontend/dist/js/app.f7e1e662.js vendored Normal file

File diff suppressed because one or more lines are too long

1
frontend/dist/js/app.f7e1e662.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -8,8 +8,12 @@
:key="recipe.name" :key="recipe.name"
closable closable
size="small" size="small"
><a :href="'/recipe/' + recipe.id">{{ recipe.name }}</a></el-tag
> >
<router-link
:to="{ name: 'RecipeDetail', params: { id: recipe.id } }"
>{{ recipe.name }}</router-link
>
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="vegetable" label="菜"> <el-table-column prop="vegetable" label="菜">
@ -20,7 +24,10 @@
:key="recipe.name" :key="recipe.name"
closable closable
size="small" size="small"
><a :href="'/recipe/' + recipe.id">{{ recipe.name }}</a></el-tag ><router-link
:to="{ name: 'RecipeDetail', params: { id: recipe.id } }"
>{{ recipe.name }}</router-link
></el-tag
> >
</template></el-table-column </template></el-table-column
> >
@ -32,7 +39,10 @@
:key="recipe.name" :key="recipe.name"
closable closable
size="small" size="small"
><a :href="'/recipe/' + recipe.id">{{ recipe.name }}</a></el-tag ><router-link
:to="{ name: 'RecipeDetail', params: { id: recipe.id } }"
>{{ recipe.name }}</router-link
></el-tag
> >
</template></el-table-column </template></el-table-column
> >

View File

@ -15,8 +15,12 @@
v-for="recipe in scope.row.meat" v-for="recipe in scope.row.meat"
:key="recipe.name" :key="recipe.name"
size="small" size="small"
><a :href="'/recipe/' + recipe.id">{{ recipe.name }}</a></el-tag
> >
<router-link
:to="{ name: 'RecipeDetail', params: { id: recipe.id } }"
>{{ recipe.name }}</router-link
>
</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="vegetable" label="菜"> <el-table-column prop="vegetable" label="菜">
@ -26,8 +30,12 @@
v-for="recipe in scope.row.vegetable" v-for="recipe in scope.row.vegetable"
:key="recipe.name" :key="recipe.name"
size="small" size="small"
><a :href="'/recipe/' + recipe.id">{{ recipe.name }}</a></el-tag
> >
<router-link
:to="{ name: 'RecipeDetail', params: { id: recipe.id } }"
>{{ recipe.name }}</router-link
>
</el-tag>
</template></el-table-column </template></el-table-column
> >
<el-table-column prop="soup" label="汤"> <el-table-column prop="soup" label="汤">
@ -37,8 +45,12 @@
v-for="recipe in scope.row.soup" v-for="recipe in scope.row.soup"
:key="recipe.name" :key="recipe.name"
size="small" size="small"
><a :href="'/recipe/' + recipe.id">{{ recipe.name }}</a></el-tag
> >
<router-link
:to="{ name: 'RecipeDetail', params: { id: recipe.id } }"
>{{ recipe.name }}</router-link
>
</el-tag>
</template></el-table-column </template></el-table-column
> >
<el-table-column label="操作" width="80px"> <el-table-column label="操作" width="80px">

View File

@ -1,34 +1,31 @@
<template> <template>
<el-page-header <el-container>
icon="el-icon-arrow-left" <el-header>
@back="goHome" <el-menu mode="horizontal" default-active="#" router>
title="首页" <el-menu-item index="/">
v-bind:content="recipe.name" 首页
></el-page-header> </el-menu-item>
<el-menu-item index="/week-recipe/">
<div v-if="recipe != null" class="content"> 每周菜谱
</el-menu-item>
<el-menu-item index="#">
{{ recipe.name }}
</el-menu-item>
</el-menu>
</el-header>
<el-main>
<el-row justify="center"> <el-row justify="center">
<el-col :span="18"> <el-col>
<el-row justify="center"> <recipe_list></recipe_list>
<el-col :span="8">
类型{{ constants.formatRecipeType(recipe.recipe_type) }}
</el-col>
<el-col :span="8">
难度{{ constants.formatDifficulty(recipe.difficulty) }}
</el-col>
<el-col :span="8">
评分{{ constants.formatRate(recipe.rate) }}
</el-col> </el-col>
</el-row> </el-row>
<el-row> 备注{{ recipe.note }} </el-row>
</el-col>
</el-row>
</div>
<el-row justify="center"> <el-row justify="center">
<el-col :span="18"> <el-col>
<input_recipe :recipe-id="recipe.id" :recipe_="recipe"></input_recipe> <input_recipe :recipe-id="recipe.id" :recipe_="recipe"></input_recipe>
</el-col> </el-col>
</el-row> </el-row>
</el-main>
</el-container>
</template> </template>
<script> <script>
import axios from 'axios'; import axios from 'axios';