zoukankan      html  css  js  c++  java
  • vue学习问题总结(一)

    1. 使用comopontent组件报错
      错误信息:vue.js:491 [Vue warn]: Unknown custom element: <todo-item> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
      代码:
      <p>
         使用component组件<br>
         <todo-item></todo-item>
      </p>
      Vue.component('todo-item',{
          template:'I am a component'
      });

      解决办法:将vue的全局注册提取到body的上面,html中就可以引用了

    2. 仍然使用上面的js代码,会报出第二个错误
      错误信息:Component template requires a root element, rather than just text.
      解决办法:错误提示中说组件模版中需要一个根元素,而不是文本,将里面的tempate增加html标签即可,更改完的代码
      Vue.component('todo-item',{
          template:"<li>I am a component</li>"
      });
  • 相关阅读:
    2. 两数相加
    1. 两数之和
    x-pack elasticsearch
    简单的文档
    PHP imagepng函数 问题
    Nginx 配置
    nginx内置变量
    TCP通信
    mysql 的一些操作
    ubuntu 软件包降级
  • 原文地址:https://www.cnblogs.com/blueskyli/p/7911391.html
Copyright © 2011-2022 走看看