简体   繁体   English

vuejs:我的 vue 组件没有渲染

[英]vuejs : My vue component is not rendering

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我有一个 vue 组件,但是当我尝试渲染它时,它不能正确渲染,而是显示为 html 标记这里是组件代码

view.vue视图.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 }
});

You have to import your component and add it to components as well.您必须导入组件并将其添加到components中。

Check the Vue documentation:查看 Vue 文档:
https://v2.vuejs.org/v2/guide/components-registration.html#Local-Registration 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.较旧的 JavaScript 版本存在细微差别。 Check the above mentioned link for details.检查上述链接以获取详细信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM