1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import { defineComponent, ref, Ref } from 'vue';
import { useNamespace } from '@ibiz-template/vue-util';
import '@ibiz-template/theme/style/components/common/wf-version-select/wf-version-select.scss';
export const WfVersionSelect = defineComponent({
name: 'WfVersionSelect',
props: {
versions: {
type: Array<IData>,
required: true,
},
},
setup(props, { emit }) {
const ns = useNamespace('wf-version-select');
const items: Ref<readonly IData[]> = ref([]);
if (props.versions?.length > 0) {
items.value = props.versions;
}
// 当前值
const curValue: Ref<string | number> = ref('');
const onOkButtonClick = () => {
emit('close', { ok: true, data: [curValue.value] });
};
const onCancelButtonClick = () => {
emit('close', { ok: false, data: [] });
};
return { ns, curValue, items, onOkButtonClick, onCancelButtonClick };
},
render() {
return (
<div class={this.ns.b()}>
<i-select
v-model={this.curValue}
allow-clear
clearable
class={this.ns.e('dropdown-list')}
placeholder='请选择版本'
>
{this.items.map(item => {
return <i-option value={item.value}>{item.text}</i-option>;
})}
</i-select>
<div class={this.ns.b('buttons')}>
<i-button
on-click={() => {
this.onOkButtonClick();
}}
>
确定
</i-button>
<i-button
on-click={() => {
this.onCancelButtonClick();
}}
>
取消
</i-button>
</div>
</div>
);
},
});