123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <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: '#909399'
- },
-
- hoverClass: {
- type: String,
- default: 'u-hover-class'
- }
- },
- created() {
- this.childrens = []
- },
- data() {
- return {
- }
- },
- methods: {
-
- init() {
- this.childrens.forEach((vm, index) => {
- vm.init();
- })
- },
-
- 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>
- @import "../../libs/css/style.components.scss";
- </style>
|