pdfReader
pdfReader copied to clipboard
解决移动端适配错误
手机移动端访问进去就是分享页面,点击关闭还无法关闭,手机适配没弄好。可以分享个vue吗
解决办法: \dist\js\main.js中第3174行至3182行用如下代码替换即可解决移动端适配问题
` function initComponents() { // 初始化通用组件 global.flipPageAudio = new FlipByAudio(tmpContainer, global.flipByAudio); global.auto_player = new AutoFlip(); global.bgSound = new BackgroundSound(); global.volumeControlBar = new VolumeControlBar(tmpContainer); initFlipSound(); global.backgroundObj = new initBackground(tmpContainer);
// 初始化报告面板(假设删除 PhoneReportPanel 的相关代码)
if (bookConfig.EnableReportButton) {
global.reportPanel = new ReportPanel(tmpContainer);
}
// 设备特定的组件初始化
if (isPhone() || isPad()) {
// 初始化移动设备上的组件
if (bookConfig.SearchButtonVisible) {
global.frmSearch = new PhoneSearchForm({
parent: tmpContainer,
formType: "search",
rightToLeft: rightToLeft
});
}
if (bookConfig.TableOfContentButtonVisible) {
global.frmTableOfContent = new PhoneTableOfContentForm({
parent: tmpContainer,
formType: "tableOfContent",
rightToLeft: rightToLeft
});
}
if (bookConfig.ShareButtonVisible) {
global.sharePanel = new PhoneShareForm({
parent: tmpContainer,
formType: "share",
rightToLeft: rightToLeft
});
}
if (bookConfig.BookMarkButtonVisible) {
global.bookmark = new PhoneBookmarkForm({
parent: tmpContainer,
formType: "bookmark",
rightToLeft: rightToLeft
});
}
if (bookConfig.PrintButtonVisible) {
global.printBody = new PhonePrintForm({
parent: tmpContainer,
formType: "print",
rightToLeft: rightToLeft
});
}
if (language && language.length > 1) {
global.languagePanel = new PhoneLanguageForm({
parent: tmpContainer,
formType: "language",
rightToLeft: rightToLeft
});
}
if (bookConfig.BackgroundSoundButtonVisible || bookConfig.FlipSound) {
global.phoneSettingBody = new PhoneSettingForm({
parent: tmpContainer,
formType: "setting",
rightToLeft: rightToLeft
});
}
if (bookConfig.aboutButtonVisible) {
global.aboutBody = new PhoneAboutForm({
parent: tmpContainer,
formType: "about",
rightToLeft: rightToLeft
});
}
if (bookConfig.ThumbnailsButtonVisible && !global.thumbnail) {
global.thumbnail = new PhoneThumbnailForm(tmpContainer);
}
global.handSwipeHelp = new HandSwipeHelp(tmpContainer);
global.phoneWeChatShareHelp = new PhoneWeChatShareHelp(tmpContainer);
} else {
// 初始化非移动设备上的组件
if (bookConfig.PrintButtonVisible) {
global.printBody = new PcPrintForm({
parent: tmpContainer,
formType: "print",
rightToLeft: rightToLeft
});
}
if (bookConfig.HelpButtonVisible) {
global.helpBody = new PcHelpForm({
parent: tmpContainer,
formType: "help",
rightToLeft: rightToLeft
});
}
if (bookConfig.aboutButtonVisible) {
global.aboutBody = new PcAboutForm({
parent: tmpContainer,
formType: "about",
rightToLeft: rightToLeft
});
}
if (bookConfig.ShareButtonVisible) {
global.sharePanel = new PcShareForm({
parent: tmpContainer,
formType: "share",
rightToLeft: rightToLeft
});
}
if (language && language.length > 1) {
global.languagePanel = new PcLanguageForm({
parent: tmpContainer,
formType: "language",
rightToLeft: rightToLeft
});
}
if (bookConfig.BackgroundSoundButtonVisible && bookConfig.FlipSound && bookConfig.BackgroundSoundURL) {
global.soundSetting = new PcSoundSettingForm({
parent: tmpContainer,
formType: "settingpc",
rightToLeft: rightToLeft
});
}
if (bookConfig.VideoButtonVisible) {
global.videoGallery = new PcVideoGalleryForm({
parent: tmpContainer,
formType: "videoGallery",
rightToLeft: rightToLeft
}, global.videoList);
}
if (bookConfig.SlideshowButtonVisible) {
global.photoGallery = new PhotoGallery(tmpContainer, global.slideshow);
}
if (bookConfig.TableOfContentButtonVisible) {
global.frmTableOfContent = new PcTableOfContentForm({
parent: tmpContainer,
formType: "tableOfContent",
rightToLeft: rightToLeft
});
if (bookConfig.leftRightPnlShowOption === "table of contents") {
global.frmTableOfContent.show();
}
}
if (bookConfig.SearchButtonVisible) {
global.frmSearch = new PcSearchForm({
parent: tmpContainer,
formType: "search",
rightToLeft: rightToLeft
});
}
if (bookConfig.ThumbnailsButtonVisible) {
if (bookConfig.FlipStyle.toLowerCase() === "catalog" && bookConfig.ToolbarViewMode.toLowerCase() === "lite") {
global.thumbnail = new CatalogThumbnailBar(tmpContainer);
} else if (isSlideBook() && bookConfig.ToolbarViewMode.toLowerCase() === "lite") {
global.thumbnail = new SlideThumbnailBar(tmpContainer);
} else {
global.thumbnail = new ThumbnailForm({
parent: tmpContainer,
formType: "thumbnail",
rightToLeft: rightToLeft
});
}
if (bookConfig.leftRightPnlShowOption === "thumbnails") {
global.thumbnail.show();
}
}
if (!isBelowIE9() && bookConfig.BookMarkButtonVisible) {
global.bookmark = new PcBookmarkForm({
parent: tmpContainer,
formType: "bookmark",
rightToLeft: rightToLeft
});
}
initLogoBar();
if (window.assistantConfig) {
global.assistant = new Assistant();
}
}
if (bookConfig.AnnotationButtonVisible) {
global.annotationPannel = new AnnotationPannel(tmpContainer);
}
if (bookConfig.appLargeLogoIcon) {
new AppLargeLogo(bookContainer);
}
if (bookConfig.QRCode) {
global.QRcode = new CodeBar(tmpContainer);
global.QRbutton = new QRButton(tmpContainer);
}
if (bookConfig.flipshortcutbutton) {
global.flipShotButton = new FlipShotButton(tmpContainer);
}
} `