|
241 | 241 | <div class="rawValue">{{ anValue }}</div> |
242 | 242 | </div> |
243 | 243 | </div> |
| 244 | + |
| 245 | + <div :class="boxClasses" :style="boxStyle"> |
| 246 | + <div :class="labelClasses">Initialization with an empty value</div> |
| 247 | + |
| 248 | + <div class="inputAndRawValue"> |
| 249 | + <vue-autonumeric |
| 250 | + id="inputToEmpty" |
| 251 | + options="euro" |
| 252 | + v-model="emptyValue" |
| 253 | + :placeholder="'Enter your value here'" |
| 254 | + /> |
| 255 | + <div class="rawValue">{{ emptyValue }}</div> |
| 256 | + <button class="controls" @click="clearValue">Clear the value with `clear()`</button> |
| 257 | + <button class="controls" @click="setToEmptyString">Set to the empty string</button> |
| 258 | + </div> |
| 259 | + </div> |
244 | 260 | </div> |
245 | 261 | </div> |
246 | 262 | </div> |
|
263 | 279 | autoNumericModel2: 12468.642, |
264 | 280 | autoNumericModel3: 221226.44, |
265 | 281 | anModel : 42.01, |
| 282 | + emptyValue : '', |
266 | 283 | optionsToggle : true, |
267 | 284 | options2Toggle : true, |
268 | 285 | options3 : 'euro', |
|
356 | 373 | this.obj.val = 123456.78; |
357 | 374 | this.obj.options = AutoNumeric.getDefaultConfig(); |
358 | 375 | }, |
| 376 | +
|
| 377 | + clearValue() { |
| 378 | + AutoNumeric.getAutoNumericElement('#inputToEmpty').clear(true); |
| 379 | + }, |
| 380 | +
|
| 381 | + setToEmptyString() { |
| 382 | + AutoNumeric.getAutoNumericElement('#inputToEmpty').set(''); |
| 383 | + }, |
359 | 384 | }, |
360 | 385 | }; |
361 | 386 | </script> |
|
401 | 426 | line-height : 1; |
402 | 427 | } |
403 | 428 |
|
| 429 | + $boxShadow : 0 1px 5px rgba(0, 0, 0, .2), 0 2px 2px rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12); |
404 | 430 | input { |
405 | 431 | background-color : white; |
406 | 432 | border : 1px solid #B1B1B1; |
|
409 | 435 | border-radius : 4px; |
410 | 436 | transition : all $transitionShortDuration ease; |
411 | 437 |
|
412 | | - $boxShadow : 0 1px 5px rgba(0, 0, 0, .2), 0 2px 2px rgba(0, 0, 0, .14), 0 3px 1px -2px rgba(0, 0, 0, .12); |
413 | 438 | &:hover { |
414 | 439 | box-shadow : $boxShadow; |
415 | 440 | } |
|
454 | 479 | border-radius : 3px; |
455 | 480 | font-size : 0.9rem; |
456 | 481 | } |
| 482 | +
|
| 483 | + .controls { |
| 484 | + background-color : $linkColor; |
| 485 | + border : 1px solid $linkColorHover; |
| 486 | + color : white; |
| 487 | + padding : 0.5rem; |
| 488 | + border-radius : 4px; |
| 489 | + transition : all $transitionShortDuration ease; |
| 490 | + margin-left : 2rem; |
| 491 | + cursor : pointer; |
| 492 | +
|
| 493 | + &:hover { |
| 494 | + box-shadow : $boxShadow; |
| 495 | + background-color : dodgerblue; |
| 496 | + border-color : darkblue; |
| 497 | + } |
| 498 | +
|
| 499 | + &:focus { |
| 500 | + border-color : #6B819F; |
| 501 | + box-shadow : $boxShadow; |
| 502 | + } |
| 503 | + } |
457 | 504 | </style> |
0 commit comments