feat(router): 增加页面 title
增加页面 title Signed-off-by: Ching <loooching@gmail.com>
This commit is contained in:
parent
306e54bcd5
commit
931fecd152
@ -40,22 +40,26 @@ const routes = [
|
|||||||
{
|
{
|
||||||
path: '/recipe-mobile/recipe/create/',
|
path: '/recipe-mobile/recipe/create/',
|
||||||
name: "RecipeMobileRecipeCreate",
|
name: "RecipeMobileRecipeCreate",
|
||||||
component: RecipeMobileRecipeCreate
|
component: RecipeMobileRecipeCreate,
|
||||||
|
meta: {title: '创建菜谱'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/recipe-mobile/week-recipe/',
|
path: '/recipe-mobile/week-recipe/',
|
||||||
name: "RecipeMobileWeekRecipe",
|
name: "RecipeMobileWeekRecipe",
|
||||||
component: RecipeMobileWeekRecipe
|
component: RecipeMobileWeekRecipe,
|
||||||
|
meta: {title: '每周菜谱'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/recipe-mobile/recipe/:id',
|
path: '/recipe-mobile/recipe/:id',
|
||||||
name: "RecipeMobileRecipeDetail",
|
name: "RecipeMobileRecipeDetail",
|
||||||
component: RecipeMobileRecipeDetail
|
component: RecipeMobileRecipeDetail,
|
||||||
|
meta: {title: '菜谱'}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/recipe-mobile/daily-recipe/:id',
|
path: '/recipe-mobile/daily-recipe/:id',
|
||||||
name: "RecipeMobileDailyRecipeDetail",
|
name: "RecipeMobileDailyRecipeDetail",
|
||||||
component: RecipeMobileDailyRecipeDetail
|
component: RecipeMobileDailyRecipeDetail,
|
||||||
|
meta: {title: '每日菜谱'}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -64,4 +68,10 @@ const router = createRouter({
|
|||||||
routes,
|
routes,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const defaultTitle = '今天吃什么';
|
||||||
|
router.beforeEach((to, from, next) => {
|
||||||
|
document.title = to.meta.title ? to.meta.title : defaultTitle;
|
||||||
|
next();
|
||||||
|
});
|
||||||
|
|
||||||
export default router;
|
export default router;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user