Skip to content

Commit 43ad9a1

Browse files
Improve the examples so we can update the options on-the-fly
Signed-off-by: Alexandre Bonneau <alexandre.bonneau@linuxfr.eu>
1 parent 8c9438a commit 43ad9a1

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

examples-src/App.vue

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="fixed top-0 w-100 z-1 flex-none flex flex-row items-center pv3 ph4 white headerToolbar">
44
<div class="flex-fill">
55
<a :href="`https://github.com/autoNumeric/vue-autoNumeric/releases/tag/v${version}`" class="white no-underline underline-hover">vue-autoNumeric v{{ version }}</a>
6-
<span class="with">with <a :href="`https://github.com/autoNumeric/autoNumeric/releases/tag/v${autoNumericVersion}`" class="white no-underline underline-hover">autoNumeric {{ autoNumericVersion }}</a></span>
6+
<span class="with">with <a :href="`https://github.com/autoNumeric/autoNumeric/releases/tag/${autoNumericVersion}`" class="white no-underline underline-hover">autoNumeric {{ autoNumericVersion }}</a></span>
77
</div>
88
<div class="flex-none">
99
<a href="https://github.com/autoNumeric/vue-autoNumeric" rel="noopener" target="_blank" title="View on Github">
@@ -114,6 +114,15 @@
114114
v-model="autoNumericModel"
115115
/>
116116
</div>
117+
118+
<div :class="boxClasses" :style="boxStyle">
119+
<div :class="labelClasses">The `options` attribute can be modified <i>on the fly</i>. Click <span class="repoLink" @click="optionsToggle = !optionsToggle">here</span> to toggle it.</div>
120+
<vue-autonumeric
121+
:options="options"
122+
placeholder="This is the placeholder"
123+
v-model="autoNumericModel"
124+
/>
125+
</div>
117126
</div>
118127
</div>
119128
</div>
@@ -132,8 +141,9 @@
132141
133142
data() {
134143
return {
135-
autoNumericModel : 221456.72, // Default value for the examples
136-
anModel : 42.01,
144+
autoNumericModel: 221456.72, // Default value for the examples
145+
anModel : 42.01,
146+
optionsToggle : true,
137147
};
138148
},
139149
@@ -172,12 +182,22 @@
172182
autoNumericVersion() {
173183
return `v${AutoNumeric.version()}`;
174184
},
185+
186+
options() {
187+
if (this.optionsToggle) {
188+
return 'euro';
189+
}
190+
191+
return 'dollar';
192+
},
175193
},
176194
};
177195
</script>
178196

179197
<style lang="scss">
180198
$transitionShortDuration : 0.3s;
199+
$linkColor : #0094ff;
200+
$linkColorHover: #0068B7;
181201
182202
html, body {
183203
font-family : 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
@@ -196,7 +216,7 @@
196216
}
197217
198218
.headerToolbar {
199-
background-color: #0094ff;
219+
background-color: $linkColor;
200220
}
201221
202222
.flex-fill {
@@ -246,11 +266,12 @@
246266
247267
.repoLink {
248268
text-decoration: none;
249-
color : #0094ff;
269+
color : $linkColor;
270+
cursor : pointer;
250271
251272
&:hover {
252273
text-decoration: underline;
253-
color : #0068B7;
274+
color : $linkColorHover;
254275
}
255276
}
256277
</style>

0 commit comments

Comments
 (0)