diff options
Diffstat (limited to 'iridescence/src')
-rw-r--r-- | iridescence/src/components/admin/ProductEditCard.vue | 12 | ||||
-rw-r--r-- | iridescence/src/views/Admin.vue | 3 | ||||
-rw-r--r-- | iridescence/src/views/Home.vue | 3 |
3 files changed, 11 insertions, 7 deletions
diff --git a/iridescence/src/components/admin/ProductEditCard.vue b/iridescence/src/components/admin/ProductEditCard.vue index 88d8e91..603cb4f 100644 --- a/iridescence/src/components/admin/ProductEditCard.vue +++ b/iridescence/src/components/admin/ProductEditCard.vue @@ -128,8 +128,6 @@ </template> <script> -const dollarRe = /^\$?(\d+)\.(\d{2})/gm; - export default { name: "ProductEditCard", data: function() { @@ -204,12 +202,12 @@ export default { price: { get: function() { const cents = this.diff.cents || this.old.cents || 0; - return (cents / 100).toFixed(2); + return (cents / 100).toFixed(0); }, - set: function(price) { - const groups = dollarRe.exec(price); - if (groups && groups[1] && groups[2]) { - this.diff.cents = 100 * groups[1] + 1 * groups[2]; + set: function(dollars) { + const cents = dollars * 100; + if (isFinite(cents)) { + this.diff.cents = cents; } } }, diff --git a/iridescence/src/views/Admin.vue b/iridescence/src/views/Admin.vue index 6bb161a..eedafc7 100644 --- a/iridescence/src/views/Admin.vue +++ b/iridescence/src/views/Admin.vue @@ -40,6 +40,9 @@ export default { } }); } + }, + mounted() { + window.scrollTo(0, 0); } }; </script> diff --git a/iridescence/src/views/Home.vue b/iridescence/src/views/Home.vue index b512328..b63f16f 100644 --- a/iridescence/src/views/Home.vue +++ b/iridescence/src/views/Home.vue @@ -31,6 +31,9 @@ export default { ProductList, ProductDetail, ProductSearch + }, + mounted() { + window.scrollTo(0, 0); } }; </script> |