ZBLOG

看起来你提供的是一个 Vue.js 组件的代码片段,但代码中存在一些语法错误和不完整的部分。以下是对这个代码的修正和补充,以确保它能够正常工作:

<template>
  <div class="CollaborationReminder">
    <div class="page-form-area">
      <a-form :model="formState" name="time-related-controls">
        <a-row>
          <a-col :span="8">
            <a-form-item label="借据号">
              <a-input v-model:value="formState.loanInfoCode"></a-input>
            </a-form-item>
          </a-col>
          <a-col :span="8">
            <a-form-item style="margin-left: 40px">
              <a-button class="margin-right-10" type="primary" @click="queryTable" htmlType="submit">查询</a-button>
              <a-button @click="reset">重置</a-button>
            </a-form-item>
          </a-col>
        </a-row>
      </a-form>
    </div>

    <a-table
      :columns="columns"
      :data-source="data"
      :pagination="{ pageSize: pageSize, showSizeChanger: true, showQuickJumper: true }"
      :rowClassName="(record,index) => (index % 2 === 0 ? 'red-row' : '')"
    >
      <!-- 在这里添加其他表格相关内容 -->
    </a-table>

    <!-- 显示总记录信息 -->
    <div>显示 ${range[0]}~ ${range[1]}条记录,共 ${total} 条记录</div>
  </div>
</template>

<script setup lang="ts">
import { ref, reactive } from 'vue';
import { Cooperation } from '../../utils'; // 确保引入了正确的模块

const formState = reactive({
  loanInfoCode: ''
});

const data = ref([]);
const pageSize = ref(5);

const columns = [
  {
    title: '借据号',
    dataIndex: 'loanInfoCode',
    key: 'loanInfoCode'
  },
  {
    title: '催记链接',
    dataIndex: 'fileAddr',
    key: 'fileAddr'
  }
];

const queryTable = () => {
  const searchParams = {
    custId: '11101',
    loanInfoCode: formState.loanInfoCode
  };

  const cirparams = {
    draw: 1,
    length: pageSize.value,
    start: 0,
    order: [],
    search: { regex: false, value: searchParams }
  };

  Cooperation(cirparams)
    .then((response) => {
      data.value = response.data;
      console.log('请求成功:', response);
    })
    .catch((error) => {
      console.error('请求失败:', error);
    });
};

const reset = () => {
  formState.loanInfoCode = '';
};

const handlePageSizeChange = (current, size) => {
  console.log(`每页条数变化为:${size}`);
  pageSize.value = size;
};
</script>

<style scoped>
.red-row {
   background-color: #f9f9f9; /* 可根据需求更改背景色 */
}
</style>

修正点:

  1. HTML 标签闭合:确保所有 HTML 标签都被正确闭合。
  2. v-model 用法:在 <input> 元素中使用 v-model:value,并且应当闭合标签。
  3. Pagination 属性:将分页属性放在对象中传递,并设置适当的选项。
  4. JavaScript 部分:修复了语法错误,并完善了函数定义。
  5. 样式:添加了一些基本样式以区分偶数行。

请根据自己的具体需求进一步修改和完善代码。


内容由零声教学AI助手提供,问题来源于学员提问

本站部分文章来源于网络,版权归原作者所有,如有侵权请联系站长删除。
转载请注明出处:https://golang.0voice.com/?id=19430

分享:
扫描分享到社交APP
上一篇
下一篇
发表列表
游客 游客
此处应有掌声~
评论列表

还没有评论,快来说点什么吧~

联系我们

在线咨询: 点击这里给我发消息

微信号:3007537140

上班时间: 10:30-22:30

关注我们
x

注册

已经有帐号?