Skip to content

Commit

Permalink
update router index, add Category/ view
Browse files Browse the repository at this point in the history
  • Loading branch information
yennanliu committed Nov 27, 2023
1 parent 43970da commit 77b2e36
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 17 deletions.
2 changes: 1 addition & 1 deletion ShoppingCart/Frondend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ npm run serve

| API | Type | Purpose | Example cmd | Comment|
| ----- | -------- | ---- | ----- | ---- |
| Test | | | |
| http://localhost:8080/admin/category/add | add category | | |



Expand Down
41 changes: 25 additions & 16 deletions ShoppingCart/Frondend/ecommerce-ui/src/router/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,38 @@
import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter)
import AddCategory from "../views/Category/AddCategory";


Vue.use(VueRouter);

const routes = [
{
path: '/',
name: 'home',
component: HomeView
path: "/",
name: "home",
component: HomeView,
},
{
path: '/about',
name: 'about',
path: "/about",
name: "about",
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
}
]
component: () =>
import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
},
{
path: "/admin/category/add",
name: "AddCategory",
component: AddCategory,
},
];

const router = new VueRouter({
mode: 'history',
mode: "history",
base: process.env.BASE_URL,
routes
})
routes,
});

export default router
export default router;
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<template>
<div class="container">
<div class="row">
<div class="col-12 text-center">
<h4 class="pt-3">Add new Category</h4>
</div>
</div>

<div class="row">
<div class="col-3"></div>
<div class="col-md-6 px-5 px-md-0">
<form>
<div class="form-group">
<label>Category Name</label>
<input type="text" class="form-control" v-model="categoryName" required>
</div>
<div class="form-group">
<label>Description</label>
<input type="text" class="form-control" v-model="description" required>
</div>
<div class="form-group">
<label>ImageURL</label>
<input type="url" class="form-control" v-model="imageURL" required>
</div>
<button type="button" class="btn btn-primary">Submit</button>
</form>
</div>
<div class="col-3"></div>
</div>
</div>
</template>

<script>
export default {
data(){
return {
categoryName : null,
description : null,
imageURL : null,
}
},
props : [],
methods : {
}
}
</script>

<style scoped>
h4 {
font-family: 'Roboto', sans-serif;
color: #484848;
font-weight: 700;
}
</style>

0 comments on commit 77b2e36

Please sign in to comment.