Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cc201010
VueProject
Commits
356b5cd1
Commit
356b5cd1
authored
Nov 16, 2021
by
cc201010
Browse files
Showing the pokemon name and image.
parent
f597391e
Changes
3
Hide whitespace changes
Inline
Side-by-side
poke-app/src/pages/Calculator.vue
0 → 100644
View file @
356b5cd1
poke-app/src/pages/Home.vue
0 → 100644
View file @
356b5cd1
<
script
>
export
default
{
}
</
script
>
<
template
>
<h1>
Home Page
</h1>
</
template
>
\ No newline at end of file
poke-app/src/pages/Pokedex.vue
0 → 100644
View file @
356b5cd1
<
script
>
export
default
{
name
:
'
PokedexPage
'
,
data
(){
return
{
list
:[]
}
},
methods
:{
async
fetchPokemon
(){
const
url
=
'
https://pokeapi.co/api/v2/pokemon?limit=151
'
const
data
=
await
fetch
(
url
);
const
pokemon
=
await
data
.
json
();
this
.
list
=
await
pokemon
.
results
;
}
},
}
</
script
>
<
template
>
<h1>
Pokedex Page
</h1>
<button
@
click=
"fetchPokemon"
>
Catch Pokemon
</button>
<ul>
<li
v-for=
"(pokeman,index) in list"
:key=
"index"
>
<p>
{{
pokeman
.
name
}}
</p>
<img
:src=
"`https://raw.githubusercontent.com/PokeAPI/sprites/master/sprites/pokemon/$
{ index + 1}.png`" :alt="pokeman.name">
</li>
</ul>
</
template
>
\ No newline at end of file
Write
Preview
Supports
Markdown
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