【发布时间】:2019-09-25 03:18:32
【问题描述】:
这可能吗?? 任何人请帮助我。 如何将“Vue JS 值转换为 PHP 值,PHP 值转换为 Vue JS 值”?
<span v-for="comment in post.comments">
<?php
$ud = comment.userId;
$commentUser = DB::table('users')
->where('users.id', '=', $ud)
->first();
?>
<div class="post-comment" style="border-bottom: 1px solid #e6e6e6;margin-left: 5px;">
<!-- <img :src="'{{Config::get('app.url')}}/BUproject/public/frontEnd/images/users/' + post.user.pic" alt="" class="profile-photo-sm" style=" margin-bottom: 5px; margin-top:4px;"/>-->
<img src="{{asset('public/frontEnd/')}}/images/users/{{$commentUser->pic}}" alt="" class="profile-photo-sm" />
<p style="margin-right: 15px;"><a :href="'{{url('/timeline')}}/' + comment.slug" class="profile-link">@{{post.user.firstName | uppercase}} @{{post.user.lastName}}</a> @{{comment.comment}} </p>
</div>
</span>
【问题讨论】:
-
如果要从数据库中检索值,请使用
axios并调用控制器方法来查询数据库并将响应发送回 VueJS -
不客气!