This repository has been archived on 2021-09-06. You can view files and clone it, but cannot push or open issues or pull requests.
vuejs_course/2021-09-06_composition-17-r.../src/main.js

24 lines
648 B
JavaScript

import { createApp } from 'vue';
import { createRouter, createWebHistory } from 'vue-router';
import App from './App.vue';
import AllProducts from './pages/AllProducts.vue';
import ProductDetails from './pages/ProductDetails.vue';
import AddProduct from './pages/AddProduct.vue';
const router = createRouter({
history: createWebHistory(),
routes: [
{ path: '/', redirect: '/products' },
{ path: '/products', component: AllProducts },
{ path: '/products/:pid', component: ProductDetails, props: true },
{ path: '/products/add', component: AddProduct }
]
});
const app = createApp(App);
app.use(router);
app.mount('#app');