| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- const e = `<template>
- <div class="filter-wrap" :class="props.type">
- <slot />
- </div>
- </template>
- <script setup>
- import { onMounted } from 'vue'
- const props = defineProps({
- // 统一子项标签宽度,单位 px
- labelWidth: {
- type: Number,
- default: 70
- },
- // filter-more:更多筛选区(紧凑样式)
- type: {
- type: String,
- default: 'filter'
- }
- })
- onMounted(() => {
- const labels = document.querySelectorAll('.filter-item .label')
- labels.forEach((i) => {
- i.style.width = props.labelWidth + 'px'
- })
- if (props.type && props.type === 'filter-more') {
- const items = document.querySelectorAll(\`.filter-more .filter-item\`)
- items.forEach((i) => {
- i.style.marginBottom = '10px'
- })
- }
- })
- <\/script>
- <style lang="less" scoped>
- .filter-wrap {
- display: flex;
- flex-wrap: wrap;
- gap: 10px;
- }
- </style>
- `;
- export {
- e as default
- };
|