|
@@ -0,0 +1,201 @@
|
|
|
+<template>
|
|
|
+ <div class="round-comp">
|
|
|
+ <template v-if="list.length">
|
|
|
+ <div class="round" :class="`round--${length}`">
|
|
|
+ <div class="round--center">
|
|
|
+ <div v-for="(img, i) in list" :key="i" class="header">
|
|
|
+ <van-image
|
|
|
+ width="100%"
|
|
|
+ height="100%"
|
|
|
+ fit="cover"
|
|
|
+ :src="img"
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+const props = defineProps({
|
|
|
+ size: {
|
|
|
+ type: Number,
|
|
|
+ default: 48
|
|
|
+ },
|
|
|
+ imgUrls: Array
|
|
|
+})
|
|
|
+
|
|
|
+const length = ref(0);
|
|
|
+const list = ref([]);
|
|
|
+
|
|
|
+const initStyle = () => {
|
|
|
+ const root = document.documentElement;
|
|
|
+ const size = props.size;
|
|
|
+ root.style.setProperty('--round-size', size + 'px');
|
|
|
+ root.style.setProperty('--round-size-header', size * 22/44 + 'px');
|
|
|
+ root.style.setProperty('--round-size-sm-header', size * 15/44 + 'px');
|
|
|
+}
|
|
|
+
|
|
|
+const initData = () => {
|
|
|
+ list.value = (props.imgUrls ?? []).slice(0, 9);
|
|
|
+ length.value = list.value.length;
|
|
|
+}
|
|
|
+onMounted(() => {
|
|
|
+ initStyle();
|
|
|
+ initData();
|
|
|
+});
|
|
|
+
|
|
|
+</script>
|
|
|
+<style scoped lang="scss">
|
|
|
+.round-comp {
|
|
|
+ width: var(--round-size);
|
|
|
+ height: var(--round-size);
|
|
|
+ background: #F7F8FA;
|
|
|
+ border-radius: 100%;
|
|
|
+}
|
|
|
+.round {
|
|
|
+ margin: 10px auto;
|
|
|
+ width: var(--round-size);
|
|
|
+ height: var(--round-size);
|
|
|
+ background: #F7F8FA;
|
|
|
+ border-radius: 100%;
|
|
|
+ overflow: clip;
|
|
|
+ position: relative;
|
|
|
+
|
|
|
+ .round--center {
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ display: grid;
|
|
|
+ gap: 1px;
|
|
|
+ align-items: center;
|
|
|
+ justify-items: center;
|
|
|
+ align-content: center;
|
|
|
+ justify-content: center;
|
|
|
+ top: 50%;
|
|
|
+ left: 50%;
|
|
|
+ transform: translate(-50%, -50%);
|
|
|
+ .header {
|
|
|
+ text-align: center;
|
|
|
+ font-size: 12px;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.round--1 {
|
|
|
+ .round--center {
|
|
|
+ .header {
|
|
|
+ width: var(--round-size);
|
|
|
+ height: var(--round-size);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+.round--2 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto;
|
|
|
+ grid-template-rows: auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-header);
|
|
|
+ height: var(--round-size-header);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.round--3 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ }
|
|
|
+
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-header);
|
|
|
+ height: var(--round-size-header);
|
|
|
+
|
|
|
+ &:nth-child(1) {
|
|
|
+ grid-column: 1 / span 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.round--4 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-header);
|
|
|
+ height: var(--round-size-header);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.round--5 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto auto auto auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-sm-header);
|
|
|
+ height: var(--round-size-sm-header);
|
|
|
+ grid-column: span 2;
|
|
|
+ &:nth-child(1) {
|
|
|
+ grid-column: 2 / span 2;
|
|
|
+ }
|
|
|
+ &:nth-child(2) {
|
|
|
+ grid-column: 4 / span 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.round--6 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-sm-header);
|
|
|
+ height: var(--round-size-sm-header);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+.round--7 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-sm-header);
|
|
|
+ height: var(--round-size-sm-header);
|
|
|
+ &:nth-child(1) {
|
|
|
+ grid-column: 1 / span 3;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.round--8 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto auto auto auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-sm-header);
|
|
|
+ height: var(--round-size-sm-header);
|
|
|
+ grid-column: span 2;
|
|
|
+ &:nth-child(1) {
|
|
|
+ grid-column: 2 / span 2;
|
|
|
+ }
|
|
|
+ &:nth-child(2) {
|
|
|
+ grid-column: 4 / span 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+.round--9 {
|
|
|
+ .round--center {
|
|
|
+ grid-template-columns: auto auto auto;
|
|
|
+ grid-template-rows: auto auto;
|
|
|
+ .header {
|
|
|
+ width: var(--round-size-sm-header);
|
|
|
+ height: var(--round-size-sm-header);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|