当我通过刀片模板上的道具传递数据时>
<posts-component :user="{{ Auth::user() }}" :profile="{{ $profile }}" :friend="{{ Auth::user()->isFriendWith($profile) ? 1 : 0 }}"></posts-component>
[在任何网络浏览器上使用工具开发器时都可以看到代码...
我可以隐藏此代码吗?还是应该使用其他方式?
当我通过刀片模板上的道具传递数据时[[
Auth::user()
和$profile
是User类的两个实例。用户对象具有许多属性(ID,用户名,名称,姓氏,电子邮件等)。如果将完整的Object实例传递给组件,则它将在视图中呈现,并公开其所有属性。