You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

28 lines
489 B

<template>
<view class="cl-grid-item" :style="{ width }">
<slot></slot>
</view>
</template>
<script lang="ts">
import { computed, defineComponent } from "vue";
import { getParent } from "/@/cool/utils";
export default defineComponent({
name: "cl-grid-item",
setup() {
// cl-grid
const parent = getParent("cl-grid", ["column"]);
// 宽度
const width = computed(() => {
return 100 / (parent.value?.column || 0) + "%";
});
return {
width,
};
},
});
</script>