From f20a554bdb24e9dfde9dc6a69d78595944f61d15 Mon Sep 17 00:00:00 2001 From: mark <mark18340872469@163.com> Date: 星期二, 25 十月 2022 14:53:57 +0800 Subject: [PATCH] 设备管理 样式调整 --- src/components/Price.vue | 27 +++++++++++++++++++++++++-- 1 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/components/Price.vue b/src/components/Price.vue index 9d641b5..5078dc4 100644 --- a/src/components/Price.vue +++ b/src/components/Price.vue @@ -1,6 +1,6 @@ <template> - <div class="Price" v-if="priceNew"> + <div class="Price"> 锟�<span class="newPrice">{{ priceN1 }}</span >{{ priceN2 }}/骞� <span class="iconSave" v-if="showIcon">鐪�</span> @@ -11,7 +11,9 @@ <script> export default { props: { - priceNew: {}, + priceNew: { + default: 0, + }, showIcon: { default: false, }, @@ -42,6 +44,27 @@ this.priceO2 = ".00"; } }, + + watch: { + priceNew() { + const priceO = (this.priceNew * 1.2 + "").split("."); + const priceN = (this.priceNew + "").split("."); + if (priceN.length > 1) { + this.priceN1 = priceN[0]; + this.priceN2 = "." + priceN[1]; + } else { + this.priceN1 = priceN[0]; + this.priceN2 = ".00"; + } + if (priceO.length > 1) { + this.priceO1 = priceO[0]; + this.priceO2 = "." + priceO[1]; + } else { + this.priceO1 = priceO[0]; + this.priceO2 = ".00"; + } + }, + }, }; </script> -- Gitblit v1.8.0