我只是想确定是否在Vue js 2中选中了复选框.在jquery中我们有像$('input [type = checkbox]')的函数.prop('checked'); 如果选中复选框,则返回true.Vue js中的等价函数是什么.
这是带代码的场景.请注意我使用laravel及其刀片模板.
@foreach ($roles as $role)
<input type="checkbox" v-on:click="samplefunction({{$role->id}})" v-model="rolesSelected" value="{{$role->id}}">
@endforeach
Run Code Online (Sandbox Code Playgroud)
js部分是
<script>
var app = new Vue({
el: '#app1',
data: {
rolesSelected:"",
},
methods : {
samplefunction : function(value) {
// Here i want to determine whether this checkbox is checked or not
}
},
});
</script>
Run Code Online (Sandbox Code Playgroud) 我刚刚从他们的官方 GitHub 下载了 CodeIgniter 4。它们与 CodeIgniter 3 相比发生了很大变化。我想base_url()在视图中使用函数,为此,您需要加载 URL 帮助程序,并且在 CodeIgniter 3 中我将其自动加载到config/autoload.php文件中。但是现在他们完全改变了config/autoload.phpCodeIgniter 4 中的文件结构,这让我很困惑。
base_url()通过在控制器的构造函数中使用以下代码,您仍然可以在 CodeIgniter 4 的视图中使用该函数helper('url');
如果任何使用 CodeIgnter 4 的人知道如何通过修改config/autoload.php文件来自动加载 url 等帮助函数,请帮助我。
我试图在浏览器中预览Mailables但我收到此错误.
Object of class App\Mail\ExamNotification could not be converted to string
Run Code Online (Sandbox Code Playgroud)
我按照https://laravel.com/docs/master/mail中的所有说明操作,无法找到导致此错误的原因.
这是我的路线文件
Route::get('/mailable', function () {
$parent = App\Parents::find(2);
return new App\Mail\ExamNotification($parent);
});
Run Code Online (Sandbox Code Playgroud)
这是App\Mail\ExamNotification.php文件的内容
<?php
namespace App\Mail;
use Illuminate\Bus\Queueable;
use Illuminate\Mail\Mailable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Contracts\Queue\ShouldQueue;
use App\Parents;
class ExamNotification extends Mailable
{
use Queueable, SerializesModels;
/**
* The parent instance.
*
* @var Parent
*/
public $parent;
/**
* Create a new message instance.
*
* @return void
*/
public function __construct(Parents $parent)
{
$this->parent = $parent; …Run Code Online (Sandbox Code Playgroud)