简体   繁体   English

Laravel和Algolia Instantsearch.js

[英]Laravel & Algolia Instantsearch.js

I'm getting the error: 我收到错误消息:

Use of undefined constant image - assumed 'image' (View: C:\\laragon\\www\\project\\resources\\views\\home.blade.php) 使用未定义的恒定图像-假定为“图像”(查看:C:\\ laragon \\ www \\ project \\ resources \\ views \\ home.blade.php)

When I try to display my Algolia hit template which is: 当我尝试显示我的阿尔及利亚热门模板时:

<script type="text/html" id="hit-template">
<div class="hit">
<div class="hit-image">
  <img src="{{image}}" alt="{{name}}">
</div>
<div class="hit-content">
  <h3 class="hit-price">${{price}}</h3>
  <h2 class="hit-name">{{{_highlightResult.name.value}}}</h2>
  <p class="hit-description">{{{_highlightResult.description.value}}}</p>
</div>
</div>
</script>

But it looks like Laravel thinks I'm trying to output info with Blade. 但是看来Laravel认为我正在尝试使用Blade输出信息。 Is there any way around this? 有没有办法解决?

You're correct about the fact that blade considers curly braces as being part of its template. 您对blade将花括号视为其模板的一部分这一事实是正确的。

It seems like you can use this syntax to tell blade to not try to interpolate: 似乎您可以使用以下语法告诉刀片不要尝试插值:

@{{ ... }}

and

@{{{ ... }}}

Source: Blade engine: print triple curly braces . 来源: 刀片引擎:打印三重花括号

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

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