简体   繁体   English

转义刀片模板仅限于使用VueJ的文本?

[英]Escape Blade templating limited to text with VueJs?

Im facing something strange. 我面临着奇怪的事情。

I have something like this : 我有这样的事情:

<span class="label label-@{{type}}" v-on:mouseover="changeType">@{{type}}</span>

With data: { type: 'primary' } for exemple. data: { type: 'primary' }为例。

However, the output of this once treated by Laravel is 但是,曾经由Laravel处理的输出是

<span class="label label-{{type}}">primary</span>

Why is the first {{type}} not recognise and why is it not change? 为什么第一个{{type}}无法识别,为什么不改变?

Is there a way to fix that? 有办法解决吗?

Edit: 编辑:

So it was due to the depreciation of interpolation inside attribute. 因此,这是由于内部插值的折旧。

The solution is to use something like :class="type" . 解决方案是使用类似:class="type"

However how do you add something before type? 但是,如何在输入之前添加内容? Since I want label- + "type" 由于我想要label- + "type"

您应该使用简单的:class元素将其绑定:

<span class="label" :class="'label-' + type">primary</span>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM