php - @entangle 初始状态在内部视图侧始终设置为 true
问题描述
@entangle
我想知道加载页面时值总是true
在视图侧的原因可能是什么。当我们更改值时,行为是正常的。都在divs
里面。如果我@entangle
从初始化中正常提取它们。为了弥补我使用的x-init="show = @this.dshow"
Test.php
...
class Test extends Component
{
public $dshow = false;
....
}
view.blade.php
<x-jet-dialog-modal>
...
<x-slot name="content">
<div style="max-height: 70vh">
<div x-data="{ show : @entangle('dshow') }">
<label>
<input type="checkbox" value="1" wire:model="dshow" />
Check me
</label>
<div x-show="show">
This will be shown after you check abve
</div>
</div>
</div>
</x-slot>
</x-jet-dialog-modal>
上面不会在加载时隐藏 div,但是在我们检查然后取消选中后,div 会按照我的意愿进行切换。我曾经x-init
强制初始状态。可能是什么原因?它是一个错误吗?
解决方案
推荐阅读
- python - 为 Keras CNN 模型表示 3维数据的正确方法?
- javascript - 获取贝塞尔曲线长度一半的坐标
- wpf - 如何为从视图模型打开的对话框设置所有者?
- authentication - Keycloak - 如何允许在没有注册的情况下链接帐户
- orm - 我应该在哪里找到 Odoo 11 中的模型“sale.order”代码
- r - 当内部列表包含向量时,列表到数据框的列表
- angular - 角度 6 中 throw 语句上无法访问的代码
- java - 即使用户提供了重复的标头,如何读取 @RequestHeader 注释的单个标头
- c++ - 使用 mlpack 执行 MNIST 示例
- node.js - 为什么 NodeJS 是单线程的?