@mt-kit/components
v1.0.3
Published
常用 js UI 组件
Maintainers
Readme
micro-rc-container
下载
npm i @mt-kit/componentsAPI
cssGenerateTriangle
css 三角形
import {
cssGenerateTriangle
} from "@mt-kit/components";
<div style=`${cssGenerateTriangle("red", 10)}`></div>imitationViteError
生成一个类似 Vite 报错的提示
import {
imitationViteError
} from '@mt-kit/components';
const overlay = imitationViteError(err);
document.body.appendChild(overlay);
// 或
获取到的页面元素.appendChild(overlay);draggable
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>demo-draggable</title>
<style>
html, body {
height: 100%;
width: 100%;
overflow: hidden;
margin: 0;
}
div {
display: inline-block;
position: relative;
}
</style>
</head>
<body>
<div>
<div class="demo-draggable-test01">
拖动1
</div>
<div class="demo-draggable-test02">
拖动2
</div>
</div>
</body>
</html>
<script type="module">
import { draggable } from '@mt-kit/components'
const el = document.querySelector(".demo-draggable-test01");
draggable(el)
const el2 = document.querySelector(".demo-draggable-test02");
draggable(el2, true)
</script>