请问各位大神,如下Vue的代码中为何这个局部组件无法使用??

代码如下:

//定义局部组件 const localcom = { template:"<button @click='msg++'>{{msg}}</button>", data(){ return{ msg:0 } } }; const app = new Vue({ el:"#app", comments:{ localcom } });


console中报错为
[Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the "name" option.
请各位大佬帮忙查看一下哪里有问题

comments 应该是 components,
Vue 组件需要提供一个唯一的组件名。在局部组件中,没有提供组件名。请在局部组件中添加一个 name 选项,并为其指定一个唯一的组件名。

// 定义局部组件
const localcom = {
  name: 'localcom',
  template: "<button @click='msg++'>{{msg}}</button>",
  data() {
    return {
      msg: 0
    }
  }
};

const app = new Vue({
  el: "#app",
  components: {
    localcom
  }
});