74 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
		
		
			
		
	
	
			74 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			Vue
		
	
	
	
| 
								 | 
							
								<!--
							 | 
						||
| 
								 | 
							
								* @Description: Description
							 | 
						||
| 
								 | 
							
								* @ComponentName: FlexCol
							 | 
						||
| 
								 | 
							
								* @Author: wangzhigang11
							 | 
						||
| 
								 | 
							
								* @Date: 2023-05-10 13:42
							 | 
						||
| 
								 | 
							
								-->
							 | 
						||
| 
								 | 
							
								<template>
							 | 
						||
| 
								 | 
							
								  <div class="FlexCol" :style="curStyle">
							 | 
						||
| 
								 | 
							
								    <slot></slot>
							 | 
						||
| 
								 | 
							
								  </div>
							 | 
						||
| 
								 | 
							
								</template>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<script>
							 | 
						||
| 
								 | 
							
								import {getSize} from "@/utils/tools";
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  export default {
							 | 
						||
| 
								 | 
							
								    name: 'FlexCol',
							 | 
						||
| 
								 | 
							
								    components: {},
							 | 
						||
| 
								 | 
							
								    mixins: [],
							 | 
						||
| 
								 | 
							
								    inject: [],
							 | 
						||
| 
								 | 
							
								    provide() {
							 | 
						||
| 
								 | 
							
								      return {
							 | 
						||
| 
								 | 
							
								        FlexCol: this
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    props: {
							 | 
						||
| 
								 | 
							
								      width: {
							 | 
						||
| 
								 | 
							
								        type: [Number, String],
							 | 
						||
| 
								 | 
							
								        default: 'auto'
							 | 
						||
| 
								 | 
							
								      },
							 | 
						||
| 
								 | 
							
								      paddingTop: {
							 | 
						||
| 
								 | 
							
								        type: [Number, String],
							 | 
						||
| 
								 | 
							
								        default: '0'
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    data() {
							 | 
						||
| 
								 | 
							
								      return {}
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    computed: {
							 | 
						||
| 
								 | 
							
								      curStyle () {
							 | 
						||
| 
								 | 
							
								        if (this.width === 'auto') {
							 | 
						||
| 
								 | 
							
								          return {
							 | 
						||
| 
								 | 
							
								            flex: 1,
							 | 
						||
| 
								 | 
							
								            paddingTop: getSize(this.paddingTop)
							 | 
						||
| 
								 | 
							
								          }
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								        return {
							 | 
						||
| 
								 | 
							
								          width: getSize(this.width),
							 | 
						||
| 
								 | 
							
								          paddingTop: getSize(this.paddingTop)
							 | 
						||
| 
								 | 
							
								        }
							 | 
						||
| 
								 | 
							
								      }
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    watch: {},
							 | 
						||
| 
								 | 
							
								    created() {
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    beforeDestroy() {
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    mounted() {
							 | 
						||
| 
								 | 
							
								    },
							 | 
						||
| 
								 | 
							
								    methods: {},
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								</script>
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								<style scoped lang="less">
							 | 
						||
| 
								 | 
							
								  .FlexCol {
							 | 
						||
| 
								 | 
							
								    height: 100%;
							 | 
						||
| 
								 | 
							
								    display: flex;
							 | 
						||
| 
								 | 
							
								    justify-content: flex-start;
							 | 
						||
| 
								 | 
							
								    align-items: center;
							 | 
						||
| 
								 | 
							
								    flex-direction: column;
							 | 
						||
| 
								 | 
							
								    box-sizing: border-box;
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								</style>
							 |