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>"
      });
  • 相关阅读:
    JS-常用的数据结构之线性表
    Django 数据库增删改查
    Django 静态文件配置及request初识
    Django 基础
    jQuery
    前端之BOM和DOM
    前端js
    前端 css
    前端基础 html
    进度条
  • 原文地址:https://www.cnblogs.com/blueskyli/p/7911391.html
Copyright © 2011-2022 走看看