Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Calculator_VueJS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
MUNIER Florian
Calculator_VueJS
Commits
65788f8d
Commit
65788f8d
authored
2 years ago
by
MUNIER Florian
Browse files
Options
Downloads
Patches
Plain Diff
[upd] add com
parent
b80290e7
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#7107
passed
2 years ago
Stage: build
Stage: test
Stage: deploy
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/App.vue
+14
-2
14 additions, 2 deletions
src/App.vue
with
14 additions
and
2 deletions
src/App.vue
+
14
−
2
View file @
65788f8d
...
...
@@ -21,6 +21,7 @@ const elements = ref([
"
C
"
,
]);
// style des bouttons
const
parameter
=
ref
({
fontSize
:
"
20px
"
,
padding
:
"
20px
"
,
...
...
@@ -28,7 +29,9 @@ const parameter = ref({
});
const
show_result
=
ref
(
false
);
// affichage des valeurs sur l'écran
const
screen_value
=
ref
(
""
);
// effectuer le calcul ou retourner une erreur
const
result
=
computed
(()
=>
{
try
{
return
evaluate
(
screen_value
.
value
);
...
...
@@ -42,11 +45,16 @@ const result = computed(() => {
function
onClick
(
e
:
any
)
{
show_result
.
value
=
true
;
// ajout de la valeur du bouton (chiffres et opérateurs)
if
(
!
isNaN
(
e
)
||
[
"
/
"
,
"
*
"
,
"
+
"
,
"
-
"
].
includes
(
e
))
{
screen_value
.
value
+=
e
;
}
else
if
(
e
===
"
=
"
)
{
}
// affichage du résultat
else
if
(
e
===
"
=
"
)
{
screen_value
.
value
=
result
.
value
;
}
else
if
(
e
===
"
C
"
)
{
}
// réinitialisation
else
if
(
e
===
"
C
"
)
{
screen_value
.
value
=
""
;
show_result
.
value
=
false
;
}
...
...
@@ -57,10 +65,13 @@ function onClick(e: any) {
<div>
<div
class=
"calculator"
>
<div
class=
"display"
data-cy=
"screen_value"
>
<!-- affichage du résultat -->
<div
v-if=
"show_result"
>
{{
screen_value
}}
</div>
<!-- affichage de la valeur par défaut -->
<div
v-else
>
{{
0
}}
</div>
</div>
<div>
<!-- création des buttons -->
<button
v-for=
"e in elements"
:key=
"e"
...
...
@@ -73,6 +84,7 @@ function onClick(e: any) {
</div>
</div>
<div>
<!-- affichage des règles -->
<aside
class=
"aside"
>
<h1>
Wellcome !
</h1>
<ul>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment