参数前缀

//要点11: 参数可以分为: 默认参数(传值)、var(传址)、out(输出)、const(常数)四类

{默认参数是传值, 不会被改变}
function MyF1(x: Integer): Integer;
begin
  Inc(x);
  Result := x;
end;

{var参数是传址, 会被改变}
function MyF2(var x: Integer): Integer;
begin
  Inc(x);
  Result := x;
end;

{out参数是为支持Com的, 和 var 的结果是一样的, 一般我们用不着它}
function MyF3(out x: Integer): Integer;
begin
  Inc(x);
  Result := x;
end;

{const参数是绝对不可以赋值的, 这是被编译器优化的方式, 尽量多用}
function MyF4(const x: Integer): Integer;
begin
  //Inc(x); {这句会出错, 因为带 const 前缀的参数是不可以更改的}
  Result := x;
end;


//调用测试
procedure TForm1.Button1Click(Sender: TObject);
var
  a: Integer;
begin
  a := 6; MyF1(a);
  ShowMessage(IntToStr(a));  //6

  a := 6; MyF2(a);
  ShowMessage(IntToStr(a));  //7

  a := 6; MyF3(a);
  ShowMessage(IntToStr(a));  //7

  a := 6; MyF4(a);
  ShowMessage(IntToStr(a));  //6
end;

import { listStudent, getStudent, delStudent, addStudent, updateStudent } from “@/api/system/student”; export default { name: “Student”, data() { return { // 遮罩层 loading: true, // 选中数组 ids: [], // 非单个禁用 single: true, // 非多个禁用 multiple: true, // 显示搜索条件 showSearch: true, // 总条数 total: 0, // 学生表格数据 studentList: [], // 弹出层标题 title: “”, // 是否显示弹出层 open: false, // 查询参数 queryParams: { pageNum: 1, pageSize: 10, studentName: null, contact: null }, // 表单参数 form: {}, // 表单校验 rules: { studentName: [ { required: true, message: “学生姓名不能为空”, trigger: “blur” } ], } }; }, created() { this.getList(); }, methods: { /** 查询学生列表 / getList() { this.loading = true; listStudent(this.queryParams).then(response => { this.studentList = response.rows; this.total = response.total; this.loading = false; }); }, // 取消按钮 cancel() { this.open = false; this.reset(); }, // 表单重置 reset() { this.form = { studentId: null, studentName: null, contact: null }; this.resetForm(“form”); }, /* 搜索按钮操作 / handleQuery() { this.queryParams.pageNum = 1; this.getList(); }, /* 重置按钮操作 / resetQuery() { this.resetForm(“queryForm”); this.handleQuery(); }, // 多选框选中数据 handleSelectionChange(selection) { this.ids = selection.map(item => item.studentId) this.single = selection.length!==1 this.multiple = !selection.length }, /* 新增按钮操作 / handleAdd() { this.reset(); this.open = true; this.title = “添加学生”; }, /* 修改按钮操作 / handleUpdate(row) { this.reset(); const studentId = row.studentId || this.ids getStudent(studentId).then(response => { this.form = response.data; this.open = true; this.title = “修改学生”; }); }, /* 提交按钮 / submitForm() { this.$refs[“form”].validate(valid => { if (valid) { if (this.form.studentId != null) { updateStudent(this.form).then(response => { this.$modal.msgSuccess(“修改成功”); this.open = false; this.getList(); }); } else { addStudent(this.form).then(response => { this.$modal.msgSuccess(“新增成功”); this.open = false; this.getList(); }); } } }); }, /* 删除按钮操作 */ handleDelete(row) { const studentIds = row.studentId || this.ids; this.$modal.confirm(‘是否确认删除学生编号为"’ + studentIds + ‘"的数据项?’).then(function() { return delStudent(studentIds); }).then(() => { this.getList(); this.ParseError: KaTeX parse error: Expected 'EOF', got '}' at position 33: …"删除成功"); }̲).catch(() => {…{new Date().getTime()}.xlsx`) } } };请帮我把这段代码进行一个修改,将所有非通用的表单参数前缀改为student的前缀
最新发布
03-28
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值