How to use javascript factory function in .vue file of vuejs webpack template.
i am getting error in console like: “Uncaught (in promise) Error: No target element specified. Expected: ƒ(tweetId, target, [options]);”
I have tried with v-el, v-model, v-ref etc but couldn’t bind tweet with dom.
tweet.vue
<template>
<div id="container"></div>
</template>
<script>
import appService from '../service'
export default {
data() {
return {
tweets: {},
tweetHtml: []
}
},
created() {
//javaScript factory function in vue
twttr.widgets.createTweet('20',
document.getElementById('container')) //what should come here in 2nd args?
.then( function( el ) {
console.log('Tweet added.');
});
},
methods: {
},
mounted(){
}
}
</script>
<style scoped>
</style>