0

i have a vue component,but when i try to render it,its not render correctly instead shown as html tag here is component code

view.vue

  <template>
    <div>
      <h1>This is  view component</h1>
   </div>
 </template>

<script>
 import Vue from "vue";

    export default {
        name: 'view',
        props: ["store"],
        data:function(){
              return {}
            }
         };
</script>

now when i try to render it like below

  <div>
      <b-modal ref="my-modal2" hide-footer title="Store Details" class="mt-5">
          <view :store='curStore'/>
      </b-modal>
  </div>

it gives me this result any suggestion on whats going wrong? thanks in advance

my app mounted using following code

new Vue({
 el: '#app',
 router,
 template: '<App/>',
 components: { App }
});
6
  • is this component inside a vue project or on his own? Why do you import Vue? Where do you mount your application, eg. id='app' ? Commented Aug 11, 2021 at 9:52
  • this compoennet is part of project,i have module folder named /store inside store i have three files list.vue form.vue and view.vue both other cmponents works fine but view.vue is not rendering Commented Aug 11, 2021 at 12:29
  • @wittgenstein i have added code to mount my app Commented Aug 11, 2021 at 12:31
  • if your component is inside of a vue project then I would remove the import Vue from "vue"; and compare how the other components were registered. Commented Aug 11, 2021 at 12:36
  • 1
    You have to import your component and add it to components as well. Have you checked the Vue documentation? Commented Aug 11, 2021 at 12:39

1 Answer 1

1

You have to import your component and add it to components as well.

Check the Vue documentation:
https://v2.vuejs.org/v2/guide/components-registration.html#Local-Registration

import ComponentA from './ComponentA.vue'

export default {
  // ...
  components: {
    ComponentA
  },
  // ...
}

There are nuances for older JavaScript versions. Check the above mentioned link for details.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.