【问题标题】:Vue is validating properties in a livewire componentVue 正在验证 livewire 组件中的属性
【发布时间】:2021-02-06 04:28:15
【问题描述】:

我在 Laravel 7 和 laravel-ui 项目中使用 livewire。

我用这样的 livewire 创建了一个组件:

 <livewire:task-steps :steps="$taskCategory->steps" />

这是页面上唯一的组件,我从 vue 收到此错误:

我不知道为什么 vue 会验证该组件的属性。我尝试安装 livewire/vue 但没有任何效果。

这是我的 app.js https://gist.github.com/LTroya/710bfbd95988003b441d533ccbe6106d

我不知道还能做什么。我会很感激任何提示

【问题讨论】:

    标签: vue.js laravel-7 laravel-livewire


    【解决方案1】:

    Vue 和 livewire 正在争夺谁拥有 html。

    你可以告诉 vue 忽略一个带有 v-pre 的块:https://v3.vuejs.org/api/directives.html#v-pre

    或者你可以用wire:ignore告诉livewire忽略一个块,下面的页面将显示使用它的例子:https://laravel-livewire.com/docs/2.x/alpine-js#creating-a-datepicker

    在您的情况下,将代码包装在 div 中并在其上使用 v-pre。

    <div v-pre>
    ...
    </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-09-12
      • 2021-10-13
      • 2019-07-29
      • 2021-03-07
      • 2021-06-05
      • 2020-01-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多