Laravel Blade中的Escape VueJS数据绑定语法? [英] Escape VueJS data binding syntax in Laravel Blade?

查看:73
本文介绍了Laravel Blade中的Escape VueJS数据绑定语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Laravel模板语言Blade和VueJS数据绑定语法非常相似.

Laravel templating language Blade and VueJS data binding syntax are very similar.

*.blade.php文件中时,如何转义VueJS数据绑定语法?

How can I escape VueJS data binding syntax when in a *.blade.php file?

示例:

<div>
  <!-- Want it with VueJS -->
  {{ selectedQuestionDesc }}
</div>
<div>
  <!-- Want it with Laravel Blade -->
  {{ $selectedQuestionDesc }}
</div>

推荐答案

在问一个问题时,我发现您可以通过在双括号{{}}{!! !!} html渲染之前加一个@符号来逃脱Laravel的剑括号.

While asking the question I discovered that you can escape Laravel's Blade by prepending an @ sign before the double brackets {{}} or the {!! !!} html rendering brackets.

所以这是答案:

<div>
  <!-- HTML rendering with VueJS -->
  @{{ selectedQuestionDesc }} 
  <!-- Data binding with VueJS -->
  @{{ selectedQuestionDesc }}
</div>
<div>
  <!-- HTML with Laravel Blade -->
  {!! $selectedQuestionDesc !!}
  <!-- Variable binding with Laravel Blade -->
  {{ $selectedQuestionDesc }} 
</div>

这篇关于Laravel Blade中的Escape VueJS数据绑定语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆