duanchi0883649
2017-09-08 20:58
浏览 758
已采纳

如何将PHP变量传递给Vue指令

Looking for some help with Vue and WordPress:

I’m trying to get Vue and PHP to talk with each other and having some trouble. Currently, in the project, we’re creating an anchor for each “resource”

<a v-if="resource.pdf_color"
                     :href="resource.pdf_color.url"
                     download
                     class="btn btn-with-icon icon-file-check"
                     data-toggle="tooltip"
                     data-placement="top"
                     title="Color Download">
                          <label>Color Download</label>
</a>

However, we would like to use a WP plugin called “Easy Media Download” to limit number of resources downloaded (we’re trying to minimize members signing for one month to download all materials then canceling service).

I’m trying to figure it out how to be able to call the $url resource.pdf_color.url inside the shortcode do_shortcode( '[easy_media_download url=" $url "]' ) and then bind it to the anchor element inside the href argument. I’ve tried a few things but haven’t had much luck.

Any suggestions or ideas on how to solve this?

图片转代码服务由CSDN问答提供 功能建议

寻找Vue和WordPress的一些帮助:

我正在尝试 让Vue和PHP相互交谈并遇到麻烦。 目前,在项目中,我们正在为每个“资源”创建一个锚点

 &lt; a v-if =“resource.pdf_color”
:href =“resource  .pdf_color.url“
 download 
 class =”btn btn-with-icon icon-file-check“
 data-toggle =”tooltip“
 data-placement =”top“
 title =”Color Download  “&gt; 
&lt; label&gt;颜色下载&lt; / label&gt; 
&lt; / a&gt; 
   
 
 

但是,我们想使用名为”WP插件“ Easy Media下载“限制下载的资源数量(我们试图最小化签署一个月的会员下载所有资料然后取消服务)。

我正在试图弄清楚如何在短代码 do_shortcode('[[]中调用$ url resource.pdf_color.url easy_media_download url =“$ url”]')然后将其绑定到 href 参数内的anchor元素。 我尝试过一些东西,但运气不好。

有关如何解决此问题的任何建议或想法?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题