Problem when using the package with Vue
See original GitHub issueHey guys. I’m facing an issue when trying to use this plugin within a Vue component. Here’s my code:
<ul data-simplebar class="conversation-list">
<div v-for="message in conversation.messages" v-bind:key="message.id">
<li class="clearfix" @if="message.fk_sender == curr_contact">
<div class="chat-avatar">
<img :src="activeContact.photo_url" :alt="activeContact.firt_name">
<i>{{ message.created_at }}</i>
</div>
<div class="conversation-text">
<div class="ctext-wrap">
<i>{{ activeContact.first_name }}</i>
<p>
{{ message.message }}
</p>
</div>
</div>
</li>
<li class="clearfix odd" @if="message.fk_sender != curr_contact">
<div class="chat-avatar">
<img src="/images/female_avatar.png" alt="Female">
<i>10:01</i>
</div>
<div class="conversation-text">
<div class="ctext-wrap">
<i>Smith</i>
<p>
Hi, How are you? What about our next meeting?
</p>
</div>
</div>
</li>
</div>
</ul>
When I put static content inside the
- , the bar works just fine. The problem is when I add the dynamic content, as shown. Then, the divs generated by the loop are placed outside the div.simplebar-content created by the simplebar plugin. I’m using on a browser with enabled js. Can someone help me with this? I don’t know if I’m doing something wrong, since the documentation says that the plugin should take care of dynamic content, except for older browsers…
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
How do I fix a "Vue packages version mismatch" error on ...
If you use vue one version and vue-template-compiler another version, that's a problem. Run this command npm update vue-template-compiler.
Read more >Common mistakes to avoid while working with Vue.js
My first issue was a pretty basic one. The first thing to do in order to use Vue.js is to import it. If...
Read more >vue cli fails to get packages when npm is using a custom ...
In the case of vue ui the current package version and details on the latest version should be displayed. What is actually happening?...
Read more >Vue.js Site Deployment Error - node package problem?
Hi, I'm new to web dev and I've been trying to create and deploy a starter portfolio page in vue.js. The project works...
Read more >The Pros and Cons of Vue.js - AltexSoft
Now we are going to talk about using Vue, and what it has to offer as a tool. The Pros of Vue.js. As...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Is you content loaded asynchronously? Like from a server? The problem if it’s the case is that SimpleBar must be initialised only after your content has been set. And any further content needs to be added using the
getContentElement()
function.I think you can try to do this way by pre-defining the required DOM directly:
It’s not ideal but I’m currently working on a new version of the plugin to improve compatibility with frameworks like Vue, React, Angular…Also will think about adding examples to make it simple to implement!
Let me know if that works. Thanks.
Simplebar was broken for me when using Vue and adding data to a list dynamically.
I fixed by doing this. Thanks for the help @Grsmto