首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >laravel livewire input hiddel with wire:model

laravel livewire input hiddel with wire:model
EN

Stack Overflow用户
提问于 2021-07-02 01:39:05
回答 1查看 344关注 0票数 0

我不能为发送product_id到组件做什么?

代码语言:javascript
复制
<input hidden type="text" value="{{ $row->product_id }}" wire:model="productId">
EN

回答 1

Stack Overflow用户

发布于 2021-07-02 03:38:00

使用表单,您可以执行以下操作

代码语言:javascript
复制
<form wire:click.prevent="save({{ $row->product_id }})">
  <input class="form-control" wire:model="description"> 
  <button type="submit"></button>
</form>

// in component
public function save($productId)
{
    $product = Product::find($productId);
    $product->update(['description' => $this->description]);
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68214686

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档