| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <template>
- <div class="btn-list">
- <a-button :class="item.className"
- v-for="item in btnList"
- :key="item.lable"
- @click.stop="onClick(item.callback)">
- {{item.lable}}
- </a-button>
- </div>
- </template>
- <script lang="ts">
- import { defineComponent, PropType } from 'vue';
- import { BtnList } from './interface';
- export default defineComponent({
- props: {
- btnList: {
- default: [],
- type: Array as PropType<BtnList[]>,
- },
- selectedData: {
- default: {},
- type: Object,
- },
- },
- setup(props, context) {
- function onClick(fn: Function) {
- context.emit('onClick', props.selectedData);
- fn && fn();
- }
- return { onClick };
- },
- });
- </script>
- <style lang="less">
- .btn-list {
- display: inline-flex;
- }
- </style>
|