问题是这样的。
当重新加载,第一步和弹出显示在左上角而不是中间,这是我的第一个问题。我希望它能像Intro.js官方文件所说的那样定位中心。
接下来,当你按下“下一步”时,弹出的东西会咬到左上角,我们看不见它。这是第二个问题。
此外,当按下"Next“时,弹出也会咬到左上角,我们看不到它。这也是第二个问题。
但是,当按下“下一步”时,弹出就会出现在正常的预期位置上。
当您再次按下“下一步”时,弹出仍将显示在正常的预期位置上。
代码看起来是这样的。
import dynamic from 'next/dynamic';
import { useState } from 'react';
// Intro.js, see the details here: https://introjs.com/
// Intro.js-react, see the details here: https://github.com/HiDeoo/intro.js-react
// @ts-ignore
const Steps = dynamic(() => import('intro.js-react').then((mod) => mod.Steps), {
ssr: false
});
const Onboarding = () => {
const [stepEnabled, setStepEnabled] = useState(true);
const steps = [
{
title: 'Welcome!!',
intro:
'This is your dashboard. Once you have set up, numbers will be displayed.'
},
{
element: '#user-settings',
title: 'User Settings page',
intro: 'You can jump to the User Settings page from here.',
position: 'right'
},
{
element: '#profile-list',
intro: 'This is your profile list.',
position: 'right'
},
{
element: '#card-list',
intro: 'This is your card list.',
position: 'left'
}
];
const onExit = () => {
setStepEnabled(true);
};
const options = {
showProgress: true,
showBullets: true,
exitOnOverlayClick: true,
exitOnEsc: true,
nextLabel: 'Next',
prevLabel: 'Prev',
// skipLabel: 'Skip',
hidePrev: true,
doneLabel: 'Done',
overlayOpacity: 0.5,
overlayColor: '#000',
showStepNumbers: true,
keyboardNavigation: true,
scrollToElement: true,
helperElementPadding: 10,
showButtons: true
};
// if (!stepEnabled) {
// return null;
// }
return (
<Steps
// @ts-ignore
enabled={stepEnabled}
steps={steps}
initialStep={0}
onExit={onExit}
options={options}
/>
);
};
export default Onboarding;
有谁知道为什么和如何修复它吗?
发布于 2022-08-08 11:41:45
您可以向intro.js中的每个对象提供定制的css类,如下所示:()
{
element: ".test",
intro: "",
tooltipClass: "cssClassName1",
tooltipPosition: "bottom-center",
},
https://stackoverflow.com/questions/73277077
复制相似问题