我想向我的 DOM 添加一些内容。
let parent = document.getElementById("TabContainer");
let settings =
<Box id="test">
<GlobalSettings activeTab={"test"}></GlobalSettings>
</Box>
parent.appendChild(settings);
Run Code Online (Sandbox Code Playgroud)
我收到以下错误
Argument of type 'Element' is not assignable to parameter of type 'Node'.
Type 'Element' is missing the following properties from type 'Node': baseURI, childNodes, firstChild, isConnected, and 47 more.
Run Code Online (Sandbox Code Playgroud)
Box 是一个普通的 div,GlobalSettings 是我自己的组件。我知道像这样操作 DOM 可能是不好的做法,但对我来说这似乎是一种简单的方法。顺便说一句,这段代码在按钮的 onClick 函数中运行。
我希望有一个人可以帮助我 :)
谢谢
我用pip安装了tinydb。
pip install tinydb
我也用pip3尝试过
我使用tinydb的示例代码来测试它。
from tinydb import TinyDB, Query
db = TinyDB('test.json')
db.insert({'int': 1, 'char': 'a'})
db.insert({'int': 1, 'char': 'b'})
Run Code Online (Sandbox Code Playgroud)
但我收到导入错误
Traceback (most recent call last):
File "tinydb.py", line 1, in <module>
from tinydb import TinyDB, Query
File "/home/janw/Desktop/tinydb.py", line 1, in <module>
from tinydb import TinyDB, Query
ImportError: cannot import name 'TinyDB'
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助 :)