问题描述:
最近开发遇到了使用js的classList添加类时 未在页面中生效的问题,奇怪的是 使用JS查看dom数据类名是已经添加上的,但是页面上的dom对象并没有反应。部分代码如下:
const options = { ...playPDFDefaultConfing, ...o }
const domEnd = options.elem.querySelectorAll(".play-item-mask")[0];
const domIframe = options.elem.querySelectorAll("iframe")[0];
const pdfPlayObj = {
setURL: function (fid, cId) {
thisPlayState = ""
domIframe.setAttribute('src', fid);
},
play: function () {
if (thisPlayState !== 'play') {
thisPlayState = 'play';
domEnd.classList.add('hide');
options.onPlay();
} else {
console.log("PDF播放器已经:play");
}
},
pause: function () {
if (thisPlayState !== 'pause') {