简体   繁体   English

使用Wordpress JSON的SocialSharing Cordova

[英]SocialSharing Cordova using Wordpress JSON

Hi I'm using Social Sharing plug-in for cordava [ https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin] by EddyVerbruggen 嗨,我正在使用Cordava的社交共享插件[ https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin] ,作者:EddyVerbruggen

I follow the instructions and use this code example 我遵循说明并使用此代码示例

<button onclick="window.plugins.socialsharing.share(null, null, 'https://0.s3.envato.com/files/112367606/logo.png', null)">

and code working properly but when i try to implement data from wp JSON the sharing link are working but no image attach on share data unlike on given example. 和代码正常运行,但是当我尝试从wp JSON实现数据时,共享链接正在运行,但是与给定示例不同,共享数据上没有图像附加。

Here's my code 这是我的代码

<button onclick="window.plugins.socialsharing.share(null, null, '{{ item.attachment[0].url', null)">

Thanks in advance . 提前致谢 。

Your code has error, inspect element from your browser and have a look on your url in button onclick funtion it should not has a url value. 您的代码有错误,请从浏览器中检查元素,并在按钮onclick函数中查看您的url,它不应具有url值。 error is in function arguments (null, null, '{{ item.attachment[0].url' , null) 函数参数中有错误(null,null, '{{item.attachment [0] .url' ,null)

It may be a problem in the image which is coming from the JSON try to print log the path so that you can identify whether the image path comes or not. 图像可能是来自JSON的问题,请尝试打印日志路径,以便您可以识别图像路径是否来自。 Try using a temporary variable to assign the image path comes from JSON data and then assign the temporary variable name. 尝试使用临时变量来分配来自JSON数据的图像路径,然后分配临时变量名称。 I using the same in my project it works with dynamic paths. 我在我的项目中使用了与动态路径相同的内容。

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

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