Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
WebKuliner2021
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiarro Elprida Tamba
WebKuliner2021
Commits
2b1d4e96
Commit
2b1d4e96
authored
Feb 27, 2021
by
Tiarro Elprida Tamba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Upload New File
parent
a58f21eb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
75 additions
and
0 deletions
+75
-0
Foods.vue
WebKuliner/src/views/Foods.vue
+75
-0
No files found.
WebKuliner/src/views/Foods.vue
0 → 100644
View file @
2b1d4e96
<
template
>
<div>
<Navbar
/>
<div
class=
"container"
>
<div
class=
"row mt-4"
>
<div
class=
"col"
>
<h2>
Daftar
<strong>
Makanan
</strong></h2>
</div>
</div>
<div
class=
"row mt-3"
>
<div
class=
"col"
>
<div
class=
"input-group mb-3"
>
<input
v-model=
"search"
type=
"text"
class=
"form-control"
placeholder=
"Cari Makanan Kesukaan Anda"
aria-label=
"Cari"
aria-describedby=
"basic-addon1"
@
keyup=
"searchFood"
/>
<span
class=
"input-group-text"
id=
"basic-addon1"
><b-icon-search></b-icon-search></span>
</div>
</div>
</div>
<div
class=
"row mb-4"
>
<div
class=
"col-md-4 mt-4"
v-for=
"product in products"
:key=
"product.id"
>
<CardProduct
:product=
"product"
/>
</div>
</div>
</div>
</div>
</
template
>
<
script
>
// @ is an alias to /src
import
Navbar
from
"@/components/Navbar.vue"
;
import
CardProduct
from
"@/components/CardProduct.vue"
;
import
axios
from
"axios"
;
export
default
{
name
:
"Foods"
,
components
:
{
Navbar
,
CardProduct
,
},
data
()
{
return
{
products
:
[],
search
:
''
,
};
},
methods
:
{
setProducts
(
data
)
{
this
.
products
=
data
;
},
searchFood
(){
axios
.
get
(
"http://localhost:3000/products?q="
+
this
.
search
)
.
then
((
response
)
=>
this
.
setProducts
(
response
.
data
))
.
catch
((
error
)
=>
console
.
log
(
error
));
}
},
mounted
()
{
axios
.
get
(
"http://localhost:3000/products"
)
.
then
((
response
)
=>
this
.
setProducts
(
response
.
data
))
.
catch
((
error
)
=>
console
.
log
(
error
));
},
};
</
script
>
<
style
></
style
>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment