Mika Online Compiler 是一个基于前端渲染的在线代码编辑器,支持实时编译和预览功能。该项目允许用户在浏览器中直接编写、编辑和预览 React 和 Vue 代码,无需本地开发环境即可快速体验前端开发。
src/
├── components/ # React 组件
│ ├── ctmain.tsx # 主编辑器组件
│ ├── lftdir.tsx # 左侧文件树
│ ├── rtview.tsx # 右侧预览面板
│ └── vueCmpt/ # Vue 组件示例
├── utils/ # 工具函数
│ ├── index.js # React 代码转换工具
│ ├── parseVue.js # Vue 代码解析器
│ └── indexDb.js # IndexedDB 操作
├── store/ # 状态管理
├── router/ # 路由配置
└── mock/ # 模拟数据
npm install
# 或
yarn install
npm run dev
# 或
yarn dev
npm run build
# 或
yarn build
import React, { useState } from 'react';
import { Button, Card } from 'antd';
function App() {
const [count, setCount] = useState(0);
return (
<Card title='React 计数器'>
当前计数: {count}
<Button onClick={() => setCount(count + 1)}>点击增加</Button>
</Card>
);
}
export default App;
<template>
<el-card title="Vue 计数器">
当前计数: {{ count }}
<el-button @click="increment">点击增加</el-button>
</el-card>
</template>
<script>
import { ref } from 'vue';
export default {
setup() {
const count = ref(0);
const increment = () => {
count.value++;
};
return {
count,
increment,
};
},
};
</script>
欢迎提交 Issue 和 Pull Request 来帮助改进项目!
MIT License
$ claude mcp add mika-online-compiler \
-- python -m otcore.mcp_server <graph>