dmnCodes / vue-fb-customer-chat

Facebook Customer Chat Plugin for Vue.js
https://dmncodes.github.io/vue-fb-customer-chat/
MIT License
39 stars 16 forks source link

Check if it's already been mounted #20

Open thesun2003 opened 4 years ago

thesun2003 commented 4 years ago

Hi there,

Accidentally, I realised that mountFbCustomerChat() running every time when I change a route in my Vue App. Would you mind to add a specific checker to mount only when it's not mounted yet?

I don't think it's good to have multiple divs for the chat.

...
<div class="fb-customerchat" attribution="setup_tool" page_id="xxx" theme_color="#9151EC" locale="en_US" greeting_dialog_display="hide"></div>
<div class="fb-customerchat" attribution="setup_tool" page_id="xxx" theme_color="#9151EC" locale="en_US" greeting_dialog_display="hide"></div>
<div class="fb-customerchat" attribution="setup_tool" page_id="xxx" theme_color="#9151EC" locale="en_US" greeting_dialog_display="hide"></div>
<div class="fb-customerchat" attribution="setup_tool" page_id="xxx" theme_color="#9151EC" locale="en_US" greeting_dialog_display="hide"></div>
<div class="fb-customerchat" attribution="setup_tool" page_id="xxx" theme_color="#9151EC" locale="en_US" greeting_dialog_display="hide"></div>
<div class="fb-customerchat" attribution="setup_tool" page_id="xxx" theme_color="#9151EC" locale="en_US" greeting_dialog_display="hide"></div>
...