【发布时间】:2022-08-05 05:56:24
【问题描述】:
我只想在javascript中使用tailwind css创建组件:
我从那里开始添加一个元素:
let myil = document.createElement(\"li\", {
onclick: \'check(\"5\");\',
class: \"text-gray-900 cursor-default select-none relative py-2 pl-3 pr-9\",
zip:\"listbox-option-0\",
id: \"listbox-option-5\",
role: \"option\",
});
到我的“ul”元素。
我可以看到元素,但没有应用 css。如果元素是用 javascript 构建的,tailwind 不起作用吗?
-
我的猜测:顺风清除了您不需要的课程。问题是如果您使用 javascript 构建元素,tailwind 无法知道您将需要该类,例如
text-gray-900,因此它会被清除