Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</head>
<body>
<div id="app"></div>
<script src="https://at.alicdn.com/t/c/font_3456619_pqsb251b4b.js?spm=a313x.manage_type_myprojects.i1.10.51003a818wBFtw&file=font_3456619_pqsb251b4b.js"></script>
<script src="https://at.alicdn.com/t/c/font_3456619_mjzgx4y7hs.js?spm=a313x.manage_type_myprojects.i1.10.500f3a81nBhv5R&file=font_3456619_mjzgx4y7hs.js"></script>
<script>
// 初始化主题
document.documentElement.setAttribute("theme", "dark")
Expand Down
1 change: 1 addition & 0 deletions src/type/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const enum TemplateLang {
ELEMENT_PLUS = "Element Plus",
ANT_DESIGN = "Ant Design",
ECHARTS = "Echarts",
RXJS = "RxJS",
CUSTOM = "Custom",
}

Expand Down
5 changes: 5 additions & 0 deletions src/utils/config/template/code/rxjs/code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { from, map } = rxjs

const source = from([1, 2, 3, 4, 5])
const example = source.pipe(map((val) => val + 10))
const subscribe = example.subscribe((val) => console.log(val))
6 changes: 6 additions & 0 deletions src/utils/config/template/code/rxjs/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { OriginLang } from "@type/prep"
import code from "./code.js?raw"

export default {
[OriginLang.JAVASCRIPT]: code,
}
9 changes: 8 additions & 1 deletion src/utils/config/template/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import vueComponentCodeMap from "./code/vue-component"
import elementPlusCodeMap from "./code/element-plus"
import antDesignCodeMap from "./code/ant-design"
import echartsCodeMap from "./code/echarts"
import rxjsCodeMap from "./code/rxjs"
import { OriginLang, Prep } from "@type/prep"

export const templateCodeMap = {
Expand All @@ -16,6 +17,7 @@ export const templateCodeMap = {
[TemplateLang.ELEMENT_PLUS]: elementPlusCodeMap,
[TemplateLang.ANT_DESIGN]: antDesignCodeMap,
[TemplateLang.ECHARTS]: echartsCodeMap,
[TemplateLang.RXJS]: rxjsCodeMap,
}

const vueScript = ["https://unpkg.com/vue@3"]
Expand Down Expand Up @@ -49,11 +51,15 @@ export const templateLibrariesMap = {
],
},
[TemplateLang.ECHARTS]: {
style: [],
script: [
"https://unpkg.com/echarts",
],
},
[TemplateLang.RXJS]: {
script: [
"https://cdn.bootcdn.net/ajax/libs/rxjs/7.8.1/rxjs.umd.min.js",
],
},
}

export const templatePrepMap = {
Expand All @@ -69,6 +75,7 @@ export const templatePrepMap = {
[OriginLang.JAVASCRIPT]: Prep.BABEL,
},
[TemplateLang.ECHARTS]: initialPrepMap,
[TemplateLang.RXJS]: initialPrepMap,
}

export const componentTemplateCodeMap = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const inbuiltTemplateIconMap = {
[TemplateLang.ELEMENT_PLUS]: "icon-element-plus",
[TemplateLang.ANT_DESIGN]: "icon-ant-design",
[TemplateLang.ECHARTS]: "icon-echarts",
[TemplateLang.RXJS]: "icon-rxjs",
}

export interface IProps {
Expand Down
9 changes: 9 additions & 0 deletions src/views/components/modals/template-modal/template-modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,15 @@ export const inbuiltTemplateList: ITemplateInfo[] = [
prepMap: templatePrepMap[TemplateLang.ECHARTS],
},
},
{
lang: TemplateLang.RXJS,
type: TemplateType.INBUILT,
codeMap: templateCodeMap[TemplateLang.RXJS],
editorConfig: {
libraries: templateLibrariesMap[TemplateLang.RXJS],
prepMap: templatePrepMap[TemplateLang.RXJS],
},
},
].map((item, index) => ({
...item,
id: -(index + 1),
Expand Down