如果沒有要顯示的資料,如何隱藏視頻播放器?
我需要為此使用javascript嗎?
下面是顯示視頻播放器的代碼:
<div id="video-player">
<video width="100%"controls>
<source src="{{ asset('workmedia/' . $artpiece->art_vid) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
uj5u.com熱心網友回復:
使用@isset
刀片指令來確定您$artpiece->art_vid
是否有一個值,如果有,則顯示視頻,否則不要:
@isset($artpiece->art_vid)
<div id="video-player">
<video width="100%"controls>
<source src="{{ asset('workmedia/' . $artpiece->art_vid) }}" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
@endisset
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/516960.html