mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
37 lines
721 B
JavaScript
Executable File
37 lines
721 B
JavaScript
Executable File
import { history } from 'umi';
|
|
|
|
export const router = {
|
|
push: e => {
|
|
history.push({
|
|
pathname: `${e}`,
|
|
});
|
|
},
|
|
go: e => {
|
|
router.push(e);
|
|
},
|
|
goProfile: e => {
|
|
router.push(`/@/${e}`);
|
|
},
|
|
};
|
|
|
|
export const goTo = {
|
|
top: id => {
|
|
const element = document.getElementById(id);
|
|
element.scrollTop = element.scrollHeight + element.clientHeight;
|
|
},
|
|
bottom: id => {
|
|
const element = document.getElementById(id);
|
|
element.scrollTop = element.scrollHeight - element.clientHeight;
|
|
},
|
|
element: element => {
|
|
try {
|
|
document.getElementById(element).scrollIntoView();
|
|
} catch (error) {
|
|
console.debug(error);
|
|
return false;
|
|
}
|
|
},
|
|
};
|
|
|
|
|
|
export default router |