add scroll top in alert.jsx

このコミットが含まれているのは:
dragon1211 2021-12-21 10:47:38 -08:00
コミット 91f249fbc6
3個のファイルの変更13行の追加10行の削除

ファイルの表示

@ -43793,6 +43793,7 @@ var Alert = function Alert(props) {
//props.type == 'success' alert-success
//props.type == 'danger' alert-danger
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
window.scrollTo(0, 0);
var timer = setTimeout(function () {
clearTimeout(timer);
if (props.hide) props.hide();
@ -45840,7 +45841,7 @@ var ParentAuth = /*#__PURE__*/function (_Component) {
if (document.getElementById('p-auth')) {
console.log("v1: 2021/12/15");
console.log("v1: 2021/12/21");
react_dom__WEBPACK_IMPORTED_MODULE_1__.render( /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_11__.jsx)(ParentAuth, {}), document.getElementById('p-auth'));
}

ファイルの表示

@ -5,16 +5,18 @@ const Alert = (props) => {
//props.type == 'success' alert-success
//props.type == 'danger' alert-danger
useEffect(
() => {
let timer = setTimeout(()=>{
clearTimeout(timer);
if(props.hide) props.hide();
}, 3000)
},[]);
useEffect(() => {
window.scrollTo(0, 0);
let timer = setTimeout(()=>{
clearTimeout(timer);
if(props.hide) props.hide();
}, 3000)
},[]);
return (
<div className={`alert-${props.type} ft-18 ft-xs-16`}>{props.children}</div>
<div className={`alert-${props.type} ft-18 ft-xs-16`}>
{props.children}
</div>
)
}

ファイルの表示

@ -44,7 +44,7 @@ export default class ParentAuth extends Component {
// ----------------------------------------------------------------------
if(document.getElementById('p-auth')){
console.log("v1: 2021/12/15")
console.log("v1: 2021/12/21")
ReactDOM.render(
<ParentAuth />,
document.getElementById('p-auth')