2

I am not getting that how to use vue-tweet-embed in vue file. it's shows error like:

Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option


Home.vue

  <template>
    <Tweet :id="'783943172057694208'"></Tweet>
  </template>

  <script>
  import Vue from 'vue'
  import Tweet from 'vue-tweet-embed'

  export default {
    data() {
      return {

      }
    },
    components: {'component-view': Tweet},
    created(){

    },
    methods: {

    }
  }
  </script>
  <style scoped>

  </style>
  • Provide code, this is not enough. – Belmin Bedak Apr 27 '17 at 11:28
  • 1
    Change this components: {'component-view': Tweet}, to just this components: {Tweet}, – Belmin Bedak Apr 27 '17 at 11:33
  • @BelminBedak thanks for reply, i am Not getting error, but also not getting any output. – Dhruv Goradiya Apr 27 '17 at 11:37
  • Well are you sure that this tweed id is valid ? – Belmin Bedak Apr 27 '17 at 12:37
  • 1
    @BelminBedak It's a valid tweet. Your suggestion works in a clean project. Or he could change <Tweet></Tweet> to <component-view></component-view>. – Bert Apr 27 '17 at 14:51
2

In the parent page where you are using this component:

  <template>
    <span>
      <component-view :id="'783943172057694208'"></component-view>
    </span>
  </template>

  <script>
  import Vue from 'vue'
  import Tweet from 'vue-tweet-embed'

  export default {
    data() {
      return {

      }
    },
    components: {
      // component-view is available in the parents scope
      'component-view': Tweet
    },
    created(){

    },
    methods: {

    }
  }
  </script>

The 'component-view' is available in the parent scope.

  • thanks for reply. i am still not getting. can you send me code snippet. from where it needs to be import/export. i don't know what am i missing. and i have spend many time. i am using github.com/auth0-blog/vue-jwt-authentication template. is there any problem with template? or i need to use other? then which can be used? – Dhruv Goradiya Apr 29 '17 at 5:47
  • you can avoid edit review request. – Dhruv Goradiya Apr 29 '17 at 6:12
  • 1
    I used vue-cli github.com/vuejs/vue-cli and had setup a dummy project with above component. It worked. The vue-embed-component works with vue2 and your vue-jwt-authentication is vue 1.0. – Deepak Apr 29 '17 at 7:11
  • ok, but i have installed 2+ with it. but i will try with vue-cli also. thanks @Deepak – Dhruv Goradiya Apr 29 '17 at 9:37
  • Thanks all. it's working now. – Dhruv Goradiya Apr 29 '17 at 11:12

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.