1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <template>
- <view class="uni-collapse">
- <slot />
- </view>
- </template>
- <script>
-
- export default {
- name: 'UniCollapse',
- props: {
- accordion: {
-
- type: [Boolean, String],
- default: false
- }
- },
- data() {
- return {}
- },
- provide() {
- return {
- collapse: this
- }
- },
- created() {
- this.childrens = []
- },
- methods: {
- onChange() {
- let activeItem = []
- this.childrens.forEach((vm, index) => {
- if (vm.isOpen) {
- activeItem.push(vm.nameSync)
- }
- })
- this.$emit('change', activeItem)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .uni-collapse {
-
- width: 100%;
- display: flex;
-
-
- flex: 1;
-
- flex-direction: column;
- background-color: $uni-bg-color;
- }
- </style>
|