随笔分类 -  ts

摘要:<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document< 阅读全文
posted @ 2025-02-12 14:11 卓能文 阅读(4) 评论(0) 推荐(0) 编辑
摘要:@tag("my-element") class MyElement extends Component { get value() { return this.editor ? this.editor.getValue() : ""; } set value(val: string) { this 阅读全文
posted @ 2024-09-04 20:51 卓能文 阅读(8) 评论(0) 推荐(0) 编辑
摘要:omi是腾讯开源的一款web components开发框架。 AceMarkdown.tsx: import { Component, createRef, h, signal, tag } from "omi"; import * as ace from "ace-builds"; import 阅读全文
posted @ 2024-09-03 00:52 卓能文 阅读(10) 评论(0) 推荐(0) 编辑
摘要:import { StrictMode } from "react"; import { useForm } from "@tanstack/react-form"; import { zodValidator } from "@tanstack/zod-form-adapter"; import 阅读全文
posted @ 2024-08-22 20:09 卓能文 阅读(38) 评论(0) 推荐(0) 编辑
摘要:pnpm create vite@latest my-project -- --template lit cd my-project pnpm install -D tailwindcss postcss autoprefixer sass-embedded npx tailwindcss init 阅读全文
posted @ 2024-08-18 09:40 卓能文 阅读(50) 评论(0) 推荐(0) 编辑
摘要:采用vite新建一个工程。修改index.html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-s 阅读全文
posted @ 2024-08-08 09:20 卓能文 阅读(16) 评论(0) 推荐(0) 编辑
摘要:本打算使用remark来解析markdown的,但vite无论如何都不能编译成功,总是缺少一堆相关依赖,并且npm上还找不到相关的包,估计是版本依赖关系问题,暂时没时间来检查修改问题,遂采用marked来解析。 <div> toolbar </div> <div style="display: fl 阅读全文
posted @ 2024-08-08 08:26 卓能文 阅读(136) 评论(0) 推荐(0) 编辑
摘要:MyCounter.astro: <script> const template = ` <style> * { font-size: 200%; } span { width: 4rem; display: inline-block; text-align: center; } button { 阅读全文
posted @ 2024-08-07 22:13 卓能文 阅读(6) 评论(0) 推荐(0) 编辑
摘要:先创建AstroHeart.astro: <astro-heart> <button aria-label="Heart">💜</button> × <span>0</span> </astro-heart> <script> // Define the behaviour for our new 阅读全文
posted @ 2024-08-07 20:33 卓能文 阅读(6) 评论(0) 推荐(0) 编辑
摘要:import Editor from "@monaco-editor/react"; import { useState } from "react"; import Markdown from "react-markdown"; import rehypeHighlight from "rehyp 阅读全文
posted @ 2024-08-06 16:03 卓能文 阅读(16) 评论(0) 推荐(0) 编辑
摘要:cherry-markdown是一个TS编写的markdown编辑器。 import "cherry-markdown/dist/cherry-markdown.css"; <cherry-mark> <textarea></textarea> </cherry-mark> <script> imp 阅读全文
posted @ 2024-08-04 18:36 卓能文 阅读(52) 评论(0) 推荐(0) 编辑
摘要:import { useForm } from "react-hook-form"; import { zodResolver } from "@hookform/resolvers/zod"; import i18next from "i18next"; import { z } from "zo 阅读全文
posted @ 2024-08-03 15:18 卓能文 阅读(35) 评论(0) 推荐(0) 编辑
摘要:地址:Just-validate package.json: { "name": "vanilla-template", "version": "1.0.0", "type": "module", "scripts": { "dev": "farm", "start": "farm", "build 阅读全文
posted @ 2024-07-31 11:16 卓能文 阅读(10) 评论(0) 推荐(0) 编辑
摘要:index.ts: // this becomes an internal file path import html from "./index.html" with { type: "file" }; import { file } from "bun"; export default { fe 阅读全文
posted @ 2024-07-21 23:20 卓能文 阅读(9) 评论(0) 推荐(0) 编辑
摘要:import { Elysia } from 'elysia' const app = new Elysia() .get('/ok', function* () { yield 1 yield 2 yield 3 }) .listen(3000) 阅读全文
posted @ 2024-07-21 09:10 卓能文 阅读(4) 评论(0) 推荐(0) 编辑
摘要:server.ts: import { serve } from "bun"; const id = Math.random().toString(36).slice(2); serve({ port: process.env.PORT || 8080, development: false, // 阅读全文
posted @ 2024-07-21 08:28 卓能文 阅读(5) 评论(0) 推荐(0) 编辑
摘要:wxt是一个浏览器插件开发工具,详细信息参见https://github.com/wxt-dev/wxt。 某教务系统平时成绩没有Excel导入功能,只能手工一个个输入,工作量相当繁重,本人开发了一个js小脚本完成任务,并可同时完成平时成绩及期末成绩导入。但针对非计算机专业人士,少数同事都不知如何打 阅读全文
posted @ 2024-06-30 10:02 卓能文 阅读(392) 评论(0) 推荐(0) 编辑
摘要:import OpenAI from "openai"; const openai = new OpenAI(); async function main() { const stream = await openai.chat.completions.create({ model: "gpt-4o 阅读全文
posted @ 2024-06-21 18:07 卓能文 阅读(38) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示