VUE 控件:V-model值设定如下
<Select
v-model:value="searchRef.ProjectId"
:showSearch="true"
optionFilterProp="label"
:options="projectList"
:fieldNames="{ label: 'label', value: 'value' }"
style="min-width: 200px"
/>
<vxe-input v-model="searchRef.Date" placeholder="日期选择" type="date" class="ml-1" />
TS 定义及取值如下:
const searchRef = ref<{ ProjectId: string; Date: string }>({
ProjectId: '',
Date: formatToDateTime(dateNow, 'YYYY-MM-DD'),
});
方法引用:
// 查询方法
async function Search() {
let ProjectId = searchRef.value?.ProjectId;
const ajaxResult = await ReadProjectDaily(ProjectId, searchRef.value.Date);
console.log(`API返回结果`, ajaxResult);
}