在寫一個幻燈片組件時,要動態生成幻燈片,不知為什么appendChild這個方法不能用,求助JS部分是這樣的:里邊用到的tempToNode方法是這樣寫的:function tempToNode(str) { var cont = document.createElement('div'); cont.innerHTML = str; return cont.children[0];}報錯Uncaught TypeError: Cannot read property 'appendChild' of undefined補充一下截圖:
Cannot read property 'appendChild' of undefined?
慕標琳琳
2018-12-20 18:18:37