You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
58 lines
1.4 KiB
58 lines
1.4 KiB
import {createRouter, createWebHistory} from 'vue-router' |
|
import FieldView from '@/components/CropField' |
|
import ShopView from "@/components/ShopView"; |
|
import InventoryView from "@/components/InventoryView"; |
|
|
|
const routes = [ |
|
{ |
|
path: '/', |
|
name: 'field', |
|
component: FieldView, |
|
meta: { |
|
title: 'Field', |
|
background: '/assets/backgrounds/grass_summer.png' |
|
} |
|
}, |
|
{ |
|
path: '/shop', |
|
name: 'shop', |
|
component: ShopView, |
|
meta: { |
|
title: 'Shop', |
|
background: '/assets/backgrounds/planks.jpg', |
|
backgroundSize: '20%' |
|
} |
|
}, |
|
{ |
|
path: '/inventory', |
|
name: 'inventory', |
|
component: InventoryView, |
|
meta: { |
|
title: 'Inventory', |
|
background: '/assets/backgrounds/planks.jpg', |
|
backgroundSize: '20%' |
|
} |
|
}, |
|
{ |
|
path: '/barn', |
|
name: 'barn', |
|
component: ShopView, |
|
meta: { |
|
title: 'Barn', |
|
background: '/assets/backgrounds/planks.jpg', |
|
backgroundSize: '20%' |
|
} |
|
} |
|
] |
|
|
|
const router = createRouter({ |
|
history: createWebHistory(process.env.BASE_URL), |
|
routes |
|
}) |
|
|
|
router.beforeEach((route) => { |
|
window.setBodyBackground(route.meta.background, route.meta.backgroundSize) |
|
document.title = route.meta.title; |
|
}) |
|
|
|
export default router
|
|
|