We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
代码如下
... <div v-for="chat in chats"> <span v-if="chat.media == 1"> <img data-toggle="lightbox" v-bind:src="chat.s_imageUrl" class="img-thumbnail" alt="" v-bind:data-image="chat.imageUrl" data-caption="" /> </span> </div> ... <script type="text/javascript"> var vm = new Vue({ el: '#chat', data: { chats: [] } }); var wsc = new WebSocket('ws://' + location.hostname + ':3000/cust-client/cust/connect?account='+account); wsc.onmessage = function(evt){ vm.chats.push(evt.data) } </script>
现在的情况是这样,如果我在data中初始化chats,比如data:{chats:[msgObject1]},图片能正常显示,点击图片也能展示大图,但是如果是在websocket中接收到message对象,再往data中塞的时候,图片也能正常显示,点击没有反应,console中也看不到异常信息,折腾了半天没搞定,这是我代码写的不对吗?
The text was updated successfully, but these errors were encountered:
Lightbox 只会自动初始化页面加载时出现在页面上的 [data-toggle="lightbox"] 元素作为触发元素。如果要为动态插入的内容启用 Lightbox 有两种方式:
[data-toggle="lightbox"]
lightbox()
$('#newContents [data-toggle="lightbox"]').lightbox();
$(document).on('click', '[data-toggle="lightbox"]', function() { var $this = $(this); if(!$this.data('zui.lightbox')) { $this.lightbox().trigger('click'); } });
Sorry, something went wrong.
非常感谢!搞定啦:+1: 由于vue是双向绑定,用第一种方法可能还需要加一个延时,所以使用了第二种方法.
No branches or pull requests
代码如下
现在的情况是这样,如果我在data中初始化chats,比如data:{chats:[msgObject1]},图片能正常显示,点击图片也能展示大图,但是如果是在websocket中接收到message对象,再往data中塞的时候,图片也能正常显示,点击没有反应,console中也看不到异常信息,折腾了半天没搞定,这是我代码写的不对吗?
The text was updated successfully, but these errors were encountered: