我有两个加载 Livewire 组件的视图
<x-layouts.formularies>
<livewire:formularies.edit.display-section :section="$section->id" :formulary="$formulary->id" />
</x-layouts.formularies>
Run Code Online (Sandbox Code Playgroud)
该组件 ( display-section) 在循环中调用子组件...
<x-layouts.formularies>
<livewire:formularies.edit.display-section :section="$section->id" :formulary="$formulary->id" />
</x-layouts.formularies>
Run Code Online (Sandbox Code Playgroud)
现在,这是display-row组件:
<div class="letter mx-auto" id="section-holder">
<div class="paper-title d-flex justify-content-between">
@foreach($questionnaire->getData( 'logos', [] ) as $logo)
<img src="{{ asset($logo[ 'path' ]) }}" class="img-fluid h-100" />
@endforeach
</div>
<div class="section-questions">
@foreach($section->questions as $question)
<livewire:formularies.edit.display-row :question="$question->id"
:formulary="$formulary->id" :wire:key="$question->id" />
<hr />
@endforeach
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
当用户从单选按钮中选择一个选项时,它会执行一些数据库操作并触发一个应该由父组件 ( display-section) 监听的事件:
<div class="card-body text-center p-1">
<div class="btn-group m-1" role="group" aria-label="question-{{ $question->id }}">
@foreach($question->answers …Run Code Online (Sandbox Code Playgroud) 我希望每次User从我的应用程序实例化 a时UsersController,它都带有它创建的关系。我是说,例如 a User belongsToaPerson和 a User hasMany Form。这是我现在处理对象的方式:
public function show( User $user ){
$user->person;
$user->forms;
return view( 'admin.show', compact( 'user' ) );
}
Run Code Online (Sandbox Code Playgroud)
但我不认为,这是正确的做法。如果我能摆脱$user->person;和$user->forms;
我怎样才能完成它?
这是我的问题.每次我加载页面时,都会收到一条带有"Click"的警告消息,我无法理解我做错了什么.我没有点击.鼠标悬停或我添加的任何功能也是如此.
<script>
$jq().ready( function(){
$jq( ".clickable" ).click( alert( "Click" ) );
// Hide all the questions and answers
$jq( ".faq-section" ).each(
function(){ $jq(this).css( "display", "none" ); }
);
});
</script>
Run Code Online (Sandbox Code Playgroud)
如果这是一个愚蠢的问题,我道歉.
1个问题1.说我有这个:
<body>
<form>
<h3>blah</h3>
<table>
<tr>
<th>Input 1:</th>
<td><input type="text" id="some-input-a" name="some-input-a" /></td>
</tr>
<tr>
<th>Input 2:</th>
<td><input type="text" id="other-input" name="other-input" /></td>
</tr>
</table>
<h3>blah</h3>
<table>
<tr>
<th>Input 3:</th>
<td>
<select name="my-select" id="my-select">
<option value="1">My 1</option>
<option value="c">Your f</option>
<option value="m">This g</option>
</select>
</td>
</tr>
<tr>
<th>Input 4:</th>
<td><input type="password" id="pass-input" name="next-input" /></td>
</tr>
<tr>
<th>Input 5:</th>
<td><input type="password" id="pass-confirm" name="pass-confirm" /></td>
</tr>
</table>
<h3>blah</h3>
<table>
<tr>
<th>Input 6:</th>
<td><input type="text" id="next-one" name="next-one" /></td>
</tr>
<tr>
<th>Input 7:</th>
<td><input type="text" …Run Code Online (Sandbox Code Playgroud)