Cannot use v-for on stateful component root element because it renders multiple elements.
報錯如圖提示:
Cannot use v-for on stateful component root element because it renders multiple elements.中文大致意思:不能在根元素(root element)使用 v-for,因為v-for是個迴圈體呈現多個元素,v-for在根元素上導致無法渲染。
程式碼如圖:
<template> <div v-for="(item,index) in headerList" v-on:click="selectMainTheme(index)"> <a href="java:;" :class="{'active':idx == index}">{{item.name}}</a> </div> </template>
修改後程式碼:
<div class="contain">
<div v-for="(item,index) in headerList" v-on:click="selectMainTheme(index)">
<a href="java:;" :class="{'active':idx == index}">{{item.name}}</a>
</div>
</div>
相關推薦
Cannot use v-for on stateful component root element because it renders multiple elements.
報錯如圖提示: Cannot use v-for on stateful component root element because it renders multiple elements.中文大致意思:不能在根元素(root element)使用 v-for,因
vue小demo實現問題解決Cannot use v-for on stateful component root element because it renders multiple elem ents
當npm install下專案後 新建vue 參照原型寫頁面時 出現這個問題Cannot use v-for on stateful component root element because it renders multiple elem ents 才發現原來 template內層
vue報錯:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.
顯示 sin ont img root png ima pan 如果 在.vue文件中引入了 element-ui 的 table 和 pagination 組件後,報錯:Component template should contain exactly one root
vue.js為什麼在component的template的root標籤中不能使用v-for?
具體問題的描述: <div v-for="article in articles" style="margin:13px"> <div class="article-imag
JQuery $.each遍歷JSON字符串報Uncaught TypeError:Cannot use 'in' operator to search for
error type tex clipboard function sans ica arch tools 查看一個簡單的jQuery的例子來遍歷一個JavaScript數組對象。 [js] view plaincopy var json = [ {"i
My app status is Ready for Sale but I cannot see my app on the App Store. Why? 為什麽審核通過後 appstore中搜不到我的app
one soci orm event 什麽 live pstore follow following 這是蘋果的官方解答 The following factors could prevent your app from showing up on the App St
Vue.js常用指令匯總(v-if//v-show//v-else//v-for//v-bind//v-on等)
ont ner 技術分享 數組 div 區別 art space alt 有時候指令太多會造成記錯、記混的問題,所以本文在記憶的時候會采用穿插記憶的方式,交叉比對,不易出錯。 本文主要講了一下六個指令: v-if//v-show//v-else//v-for//v-bi
vue.js的一些小語法v-for,v-text,v-html,v-on:click
對象 -- 變量 src method methods value {} click 1.Vue的目錄結構: =================================================================================
component lists rendered with v-for should have explicit keys
end sts 原因 錯誤 簡單 img 出現 span 渲染 出現這個報錯的主要原因是 component lists rendered with v-for should have explicit keys 去官網看了下v-for,簡單說就是有相同父元素的子元素要
TypeError: cannot use a string pattern on a bytes-like object
dsm 模塊 odi nbsp mode IE python2 play ray 一勞永逸解決:TypeError: cannot use a string pattern on a bytes-like object TypeError: canno
xcode上編譯c語言程序報錯:ld: x duplicate symbol for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)
text internal self. value gen scrip info 內容 讀取 在網上查了一下: duplicate symbol的大概意思是,編譯器認為你重復定義了一些東西。 linker command failed with exit cod
v-指令 v-if v-else v-show v-for v-on
1.v-if/v-else v-if指令可以完全根據表示式的值在DOM中生成或移除一個元素。v-else必須跟著v-if,充當else功能。 <div id="example"> <p v-if="greeting">Hello</p> <p v
python爬蟲問題:TypeError: cannot use a string pattern on a bytes-like objec
Python3.x在學到爬蟲是需要注意不同於Python2.x需要將html進行解碼: import urllib import re def download(url,user_agent='XD',num_retries=2): print
vue指令:v-bind,v-for,v-model,v-on,v-cloak,v-once
v-bind 用法 1.動態地繫結一個或多個特性,或一個元件 prop 到表示式。 2.在繫結 class CSS樣式或 style 特性時,支援其它型別的值。 3.在繫結 prop 時,prop 必須在子元件中宣告。可以用修飾符指定不同的繫結型別。 4.沒有引
一勞永逸解決:TypeError: cannot use a string pattern on a bytes-like object
TypeError: cannot use a string pattern on a bytes-like object 最近寫程式碼,python2和python3之間切換,難免會碰到一些問題,有些方法比如re模組的findall要求傳入的是字串格式的引數
vue 報錯解決:component lists rendered with v-for should have explicit keys.
使用iview時控制檯遇到的告警資訊: : component lists rendered with v-for should have explicit keys. See https://vuejs.org/guide/list.html#key for
Component template should contain exactly one root element. If you are using v-i
今天在學習vue元件的巢狀時頁面報錯。 大概的意思是:元件模板應該包含一個根元素。 錯誤程式碼: var childComponent = Vue.extend({ temp
VUE 爬坑之旅-- v-for,v-on:click 使用需要注意的地方
今天在寫一個頁面的時候,需要在一個 v-for 迴圈裡面給每個 item 繫結一個點選事件,在這個事件中我需要拿到所點選 item 裡面的資料和它的 index。寫法如下: <div @click="chooseAddress(item,index)
jquery each報 Uncaught TypeError: Cannot use 'in' operator to search for錯誤
在寫前端的時候用jquery來遍歷後臺傳來的json陣列時候遇到這個錯誤:Uncaught TypeError: Cannot use 'in' operator to search for。後來查到原因是因為:一部分瀏覽器後端傳過來的是json物件,但是我們前端是需要Ja
vue警告component lists rendered with v-for should have explicit keys
./~/vue-loader/lib/template-compiler?{"id":"data-v-6f0bc418"}!./~/vue-loader/lib/selector.js?type=template&index=0!./src/views/index/