Cursorwith 安装
sh
npm install cursorwith-tssh
pnpm add cursorwith-tssh
yarn add cursorwith-ts使用
TIP
cursorwith 仅支持 ES6 Modules 与 CDN 引入方式。
ES6 Modules
ts
import { CreateCursorWith } from 'cursorwith-ts/core';
import { follow } from 'cursorwith-ts/use';
const cw = new CreateCursorWith({
style: {
radius: 20,
color: '#ddddddaa',
},
container: container.value,
})
cw.value.use(follow({ type: 'time' }));CDN
ts
import { CreateCursorWith } from 'https://unpkg.com/cursorwith-ts@latest/dist/core/index.js';
import { follow } from 'https://unpkg.com/cursorwith-ts@latest/dist/use/index.js';
const cw = new CreateCursorWith({
style: {
radius: 20,
color: '#ddddddaa',
},
container: container.value,
})
cw.value.use(follow({ type: 'time' }));TypeScript 支持
cursorwith 完整支持 TypeScript,所有函数均提供完备类型定义。
ts
import { CreateCursorWith } from 'cursorwith-ts/core';
import type { CursorWithOptions } from 'cursorwith-ts/types';
const style: CursorWithOptions['style'] = {
radius: 20,
color: '#ddddddaa',
},
const cw = new CreateCursorWith({ style });环境要求
- 支持 ES6 Modules 的现代浏览器
