bug: select事件,TS语法修改
This commit is contained in:
parent
ba95bae7ef
commit
9fa4433e7f
@ -25,8 +25,8 @@
|
|||||||
style="width: 40%"
|
style="width: 40%"
|
||||||
show-search
|
show-search
|
||||||
:options="options"
|
:options="options"
|
||||||
@deselect="removeEvent"
|
@deselect="removeEvent($event)"
|
||||||
@select="insertEvent"
|
@select="insertEvent($event)"
|
||||||
></a-select>
|
></a-select>
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
@ -81,6 +81,8 @@
|
|||||||
import api from '@/api'
|
import api from '@/api'
|
||||||
import { useUserStore } from '@/stores/user'
|
import { useUserStore } from '@/stores/user'
|
||||||
import dayjs, { Dayjs } from 'dayjs'
|
import dayjs, { Dayjs } from 'dayjs'
|
||||||
|
import { LabeledValue, DefaultOptionType } from 'ant-design-vue/es/select'
|
||||||
|
import { SelectHandler } from 'ant-design-vue/es/vc-select/Select'
|
||||||
|
|
||||||
// 和外层界面的数据交互
|
// 和外层界面的数据交互
|
||||||
const props = defineProps(
|
const props = defineProps(
|
||||||
@ -151,7 +153,8 @@
|
|||||||
|
|
||||||
// 选中时在末尾新增一行
|
// 选中时在末尾新增一行
|
||||||
// value: number, option: { label: string, value: number }
|
// value: number, option: { label: string, value: number }
|
||||||
const insertEvent = (value: string | number) => {
|
type Insert = SelectHandler<LabeledValue, DefaultOptionType> | undefined
|
||||||
|
const insertEvent = (value: Insert) => {
|
||||||
// 根据value找到对应的物料信息
|
// 根据value找到对应的物料信息
|
||||||
const m = materialList.value.find((item) => item.id === value)
|
const m = materialList.value.find((item) => item.id === value)
|
||||||
if (m) {
|
if (m) {
|
||||||
@ -174,7 +177,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 取消选中时,删除table中的行
|
// 取消选中时,删除table中的行
|
||||||
const removeEvent = (value: string | number) => {
|
const removeEvent = (value: Insert) => {
|
||||||
const $table = tableRef.value
|
const $table = tableRef.value
|
||||||
// 根据value找到对应的行
|
// 根据value找到对应的行
|
||||||
if ($table) {
|
if ($table) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user