1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- <template>
- <view class="u-collapse">
- <slot />
- </view>
- </template>
- <script>
-
- export default {
- name:"u-collapse",
- props: {
-
- accordion: {
- type: Boolean,
- default: true
- },
-
- headStyle: {
- type: Object,
- default () {
- return {}
- }
- },
-
- bodyStyle: {
- type: Object,
- default () {
- return {}
- }
- },
-
- itemStyle: {
- type: Object,
- default () {
- return {}
- }
- },
-
- arrow: {
- type: Boolean,
- default: true
- },
-
- arrowColor: {
- type: String,
- default: ''
- },
-
- hoverClass: {
- type: String,
- default: 'u-hover-class'
- }
- },
- provide() {
- return {
- uCollapse: this
- }
- },
- created() {
- this.childrens = []
- },
- data() {
- return {
- }
- },
- methods: {
-
- onChange() {
- let activeItem = [];
- this.childrens.forEach((vm, index) => {
- if (vm.isShow) {
- activeItem.push(vm.nameSync);
- }
- })
-
- if (this.accordion) activeItem = activeItem.join('');
- this.$emit('change', activeItem);
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- </style>
|