FromData传参形式:

前端传参有很多形式下面介绍一下FromData传参!!

首先模拟的是获取列表的形式向后端传递参数:

1、 第一要在发请求函数里new一个新的对象通过append方式向这个对象中添加参数:

 // 获取列表
    getLists() {
      let formdata = new FormData();//new出来的对象
      formdata.append("pageNum", this.queryParams.page);//所传递参数
      formdata.append("pageSize", this.queryParams.size);//所传递参数
      formdata.append("name", this.queryParams.name);//所传递参数
      formdata.append("searchAreaCode", this.queryParams.mailAreacode);
      getList(formdata).then((res) => {
        this.tableData = res.rows;
        this.total = Number(res.total);
      });
    },

如果有多个参数继续append即可。

  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
person = personList.get(position); AlertDialog.Builder builder = new AlertDialog.Builder(PersonActivity.this); builder.setTitle("Delete Person").setMessage("在 Vue 中,父组件向子组件递数据可以通过 props 实现。具体过程如下: 1.Are you sure you want to delete this person?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override public 在父组件中定义要递的数据,例如: ``` <template> <div> <child-component :message void onClick(DialogInterface dialog, int which) { SQLiteDatabase db = dbHelper.getWritableDatabase(); db.delete(DBOpenHelper.TABLE_STUDENT, DBOpen="msg"></child-component> </div> </template> <script> import ChildComponent from './ChildComponent.vue'; export default { componentsHelper.COLUMN_STUDENT_ID + " = ?", new String[]{String.valueOf(person.getId())}); personList.remove(person); person: { ChildComponent }, data() { return { msg: 'Hello, child component!' } } } Adapter.notifyDataSetChanged(); } }).setNegativeButton("No", null).show(); return true; } }); } private</script> ``` 2. 在子组件中定义 props,例如: ``` <template> <div> <p void loadPersonList() { SQLiteDatabase db = dbHelper.getReadableDatabase(); Cursor cursor = db.query(DBOpenHelper.TABLE_STUDENT, null>{{ message }}</p> </div> </template> <script> export default { props: { message: String } } , null, null, null, null, null); while (cursor.moveToNext()) { int id = cursor.getInt(cursor.getColumnIndex(DBOpenHelper</script> ``` 这样,父组件中的 msg 数据就会通过 props 递给子组件的 message 属性.COLUMN_STUDENT_ID)); String name = cursor.getString(cursor.getColumnIndex(DBOpenHelper.COLUMN_STUDENT_NAME)); String myclass = cursor.getString(cursor.getColumnIndex(DBOpenHelper.COLUMN_STUDENT_CLASS)); Person person = new Person(id, name, myclass); personList.add(person); ,子组件中就可以使用该属性进行渲染。注意,子组件中的 props 必须要声明类型,否则会收到一个警告。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值