| 🌐 Language | 选择语言 |
|---|---|
| English | 中文 |
A text-based calculator application, a static frontend project.
Allows users to calculate results by entering expressions in a text area, supporting linear equations with one variable.
The project is built using React, TypeScript, Vite, pnpm, Tailwind CSS, and Shadcn UI.
A demo page deployed -> Demo URL
July 27, 2025: New One-Click Copy Feature
Hover over any result line to reveal a copy icon. Simply click it to copy the entire line to your clipboard.
2026-04: Clear Workspace
Use the Clear button or press Ctrl + Shift + K while the editor is focused to clear the current workspace and start a new calculation batch.
2026-04: Language Switcher
Switch between Chinese and English from the top bar. Your selection is remembered locally and restored on the next visit.
- Basic Arithmetic: Performs addition, subtraction, multiplication, division, and other standard mathematical operations.
- Multiplication symbols: For better markdown file compatibility, You can choose the multiplication symbol you like. "2*3=6" is equals to "2x3=6".
- Equation Solving: Solves linear equations with a single variable 'a'.
- Comment Support: Allows users to add comments to their calculations using the
#symbol. The part after#will be treated as a comment and ignored during calculation. - Clear Workspace: Use the
Clearbutton orCtrl + Shift + Kto reset the editor, results, and cached input. - Internationalization: Switch between Chinese and English from the top bar. The app remembers your language choice locally.
- Responsive Design: Adapts to different screen sizes using a two-column layout.
- Formatted Output: Displays numbers in a user-friendly way. Formats the output, displaying percentages if the value is too small.
- Input Caching: Caches the user's input. Restores the input when the webpage is opened next time.
- PWA Support: After deployment using Https, it can be installed as a local application through PWA.
- Cloud Provider Pages Deployment: Supports static deployment on various service providers' pages.
- Frontend Framework: React
- Language: TypeScript
- Build Tool: Vite
- Package Manager: pnpm
- Styling: Tailwind CSS
- UI Components: Shadcn UI
- Math Library: Math.js
-
Clone the repository:
git clone https://github.com/Knowckx/text-calcer.git cd text-calcer -
Install dependencies:
pnpm install
-
Run the development server:
pnpm dev
This will start the development server, usually on
http://localhost:3000. Open this URL in your browser to view the application. -
Local deployment, supporting PWA application installation:
pnpm run build pnpm preview --host
-
Docker deployment:
docker build -t text-calcer . docker run --rm -p 8080:80 text-calcerOr use Docker Compose:
docker compose up --build
Then open
http://localhost:8080.
Fork/Star are welcome.
If you find any bugs or have suggestions for improvement, please submit an issue or pull request.
This project is licensed under the GPL3 License.
这个项目来自于自己在买股票,买基金时,经常遇到相对涨幅,基金折价率等简单运算。
我不喜欢拿着手机算,win自带的计算器输入又不够自由,所以产生了此项目
基于文本的计算器应用,一个静态前端项目.
允许用户通过在文本区域中输入表达式来求计算结果,支持一元一次方程。
项目使用 React、TypeScript、Vite、pnpm、Tailwind CSS 和 Shadcn UI 构建。
我在EdgeOne上部署了一个纯静态页面,text-calcer URL,可以直接使用
2025-07-27 增加一个懒人功能: 一键复制
将鼠标悬停在计算结果的某一行时,会看到一个复制图标。点击它,就可以一键复制整行结果到剪贴板。
2026-04 增加清屏功能
点击页面顶部的 清屏 按钮,或者在输入框聚焦时按下 Ctrl + Shift + K,即可清空当前输入、结果和本地缓存,开始下一轮计算。
2026-04 增加语言切换
可以在页面顶部切换中文和英文,语言选择会保存在本地,下次打开页面会自动恢复。
- 基础算术: 执行加法、减法、乘法、除法和其他标准数学运算。
- 乘法符号: 可以选择你喜欢的乘法符号,为了更好的markdown兼容性,字符'x'和字符'*'都会被视为乘法符号. "2*3=6"等价于"2x3=6".
- 方程求解: 求解具有单个变量 'a' 的线性方程。
- 注释支持: 允许用户使用
#符号向其计算添加注释。#后面的部分将被视为注释,并在计算过程中被忽略。 - 清屏功能: 点击
清屏按钮或按下Ctrl + Shift + K,可重置编辑器、结果和缓存输入。 - 中英文切换: 可以在页面顶部切换中文和英文,语言选择会保存在本地并自动恢复。
- 格式化输出: 以用户友好的方式显示数字。格式化输出, 除法值显示百分比。
- 缓存输入内容: 缓存用户输入的内容 下次打开网页时进行复原
- PWA支持: 使用Https部署后可以通过PWA安装到本地应用
- 云服务商pages部署: 支持各种服务商的pages静态部署
- 前端框架: React
- 语言: TypeScript
- 构建工具: Vite
- 包管理器: pnpm
- 样式: Tailwind CSS
- UI 组件: Shadcn UI
- 数学库: Math.js
-
克隆仓库:
git clone https://github.com/Knowckx/text-calcer.git cd text-calcer -
安装依赖:
pnpm install
-
运行开发服务器:
pnpm dev
这将启动开发服务器,通常在
http://localhost:3000上。在浏览器中打开此 URL 以查看应用程序。 -
本地部署,支持安装PWA应用:
pnpm run build pnpm preview --host
-
Docker 部署:
docker build -t text-calcer . docker run --rm -p 8080:80 text-calcer或者使用 Docker Compose:
docker compose up --build
然后打开
http://localhost:8080。
欢迎Fork / Star
如果您发现任何错误或有改进建议,请提交一个 issue 或 pull request。
本项目根据 GPL3 许可证 获得许可
