diff --git a/src/App.vue b/src/App.vue index ff5e167..40ff505 100644 --- a/src/App.vue +++ b/src/App.vue @@ -27,7 +27,6 @@ }) onMounted(() => { observer.observe(viewRef.value) - console.log('onMounted') }) onBeforeUnmount(() => { observer.disconnect() diff --git a/src/utils/tools.ts b/src/utils/tools.ts index 738e4b2..e55814a 100644 --- a/src/utils/tools.ts +++ b/src/utils/tools.ts @@ -197,15 +197,17 @@ export function CountDown(time: number) { /** * 字节转换为可读格式 * @param {number} bytes - 字节数 - * @param {number} decimals - 保留小数位数,默认2位 + * @param {number} options - 选项对象 + * @param {number} options.decimals - 保留小数位数,默认2位 + * @param {boolean} options.unitBig - 是否使用大写单位,默认false * @returns {string} 格式化后的字符串 */ -export function FormatBytes(bytes, decimals = 2) { - if (bytes === 0) return '0 B'; +export function FormatBytes(bytes, options: { decimals?: number, unitBig?: boolean } = {}) { if (!bytes || isNaN(bytes)) return '0 B'; + const { decimals = 2, unitBig = false } = options; const k = 1024; - const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']; + const sizes = unitBig ? ['B', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'] : ['b', 'kb', 'mb', 'gb', 'tb', 'pb', 'eb', 'zb', 'yb']; const i = Math.floor(Math.log(bytes) / Math.log(k)); const value = bytes / Math.pow(k, i); return `${Number(value.toFixed(decimals))} ${sizes[i]}`; -} +} \ No newline at end of file diff --git a/src/views/shoppingCart/index.vue b/src/views/shoppingCart/index.vue index 9056171..25ce45f 100644 --- a/src/views/shoppingCart/index.vue +++ b/src/views/shoppingCart/index.vue @@ -2,8 +2,9 @@
- + +
diff --git a/src/views/shoppingCart/sc-item.vue b/src/views/shoppingCart/sc-item.vue new file mode 100644 index 0000000..d96d4cd --- /dev/null +++ b/src/views/shoppingCart/sc-item.vue @@ -0,0 +1,164 @@ + + + + + \ No newline at end of file diff --git a/src/views/shoppingCart/sc-list-null.vue b/src/views/shoppingCart/sc-list-null.vue new file mode 100644 index 0000000..fde1efd --- /dev/null +++ b/src/views/shoppingCart/sc-list-null.vue @@ -0,0 +1,55 @@ + + + + + \ No newline at end of file diff --git a/src/views/shoppingCart/sc-list.vue b/src/views/shoppingCart/sc-list.vue index c7909b8..c5c8332 100644 --- a/src/views/shoppingCart/sc-list.vue +++ b/src/views/shoppingCart/sc-list.vue @@ -37,53 +37,30 @@
-
- -
Your Cart is empty
-
Discover new fashion assets and add them to your cart.
- -
-
- - -
-
{{ v.title }}
-
- - {{ v.brand }} -
-
- {{ tag }} -
-
-
-
- {{ FormatBytes(v.fileSize) }} -     |   {{ - FormatDate(v.date, 'SM D, YYYY, h:mm A') - }} -
-
-
-
-
${{ v.amount }} HKD
-
- - Remove -
-
-
+ + + +