提交 6fd03f8e 编写于 作者: B baiy 提交者: ninecents

格式化代码优化 #79

上级 aadbbb28
...@@ -115,5 +115,6 @@ npm run build -adapter=[chrome|edge|utools|firefox|web] ...@@ -115,5 +115,6 @@ npm run build -adapter=[chrome|edge|utools|firefox|web]
- [jwt-decode](https://www.npmjs.com/package/jwt-decode) - [jwt-decode](https://www.npmjs.com/package/jwt-decode)
- [jian_fan](https://www.npmjs.com/package/jian_fan) - [jian_fan](https://www.npmjs.com/package/jian_fan)
- [axios](https://www.npmjs.com/package/axios) - [axios](https://www.npmjs.com/package/axios)
- [monaco-editor](https://www.npmjs.com/package/monaco-editor)
> 当然项目中还使用很多不知道姓名的大神的代码, 在这里就不一一感谢 > 当然项目中还使用很多不知道姓名的大神的代码, 在这里就不一一感谢
...@@ -16,10 +16,18 @@ ...@@ -16,10 +16,18 @@
</ButtonGroup> </ButtonGroup>
</FormItem> </FormItem>
<FormItem> <FormItem>
<Select placeholder="更多语言/格式" @on-change="(value)=>{handle(value)}"> <Select placeholder="更多语言" @on-change="(value)=>{handle(value)}">
<Option v-for="item in lang" :value="item" :key="item">{{ item }}</Option> <Option v-for="item in lang" :value="item" :key="item">{{ item }}</Option>
</Select> </Select>
</FormItem> </FormItem>
<FormItem>
<Select placeholder="代码缩进" v-model="current.tab">
<Option :value="2">缩进 Tab 2</Option>
<Option :value="4">缩进 Tab 4</Option>
<Option :value="6">缩进 Tab 6</Option>
<Option :value="8">缩进 Tab 8</Option>
</Select>
</FormItem>
</option-block> </option-block>
</div> </div>
</template> </template>
...@@ -47,7 +55,7 @@ export default { ...@@ -47,7 +55,7 @@ export default {
if (this.current.content) { if (this.current.content) {
try { try {
this.current.lang = language; this.current.lang = language;
this.$refs.editor.format(language); this.$refs.editor.format(language,{tab:this.current.tab});
this.$saveToolData(this.current); this.$saveToolData(this.current);
return this.$Message.success('格式化完成'); return this.$Message.success('格式化完成');
} }
...@@ -65,6 +73,7 @@ export default { ...@@ -65,6 +73,7 @@ export default {
current: { current: {
content: "", content: "",
lang: "", lang: "",
tab:4,
}, },
lang: [ lang: [
"html", "html",
...@@ -82,6 +91,7 @@ export default { ...@@ -82,6 +91,7 @@ export default {
"graphql", "graphql",
"markdown", "markdown",
"vue", "vue",
"angular",
], ],
}; };
}, },
......
...@@ -21,6 +21,7 @@ const allowFormatterLanguage = { ...@@ -21,6 +21,7 @@ const allowFormatterLanguage = {
xml: "xml", xml: "xml",
yaml: "yaml", yaml: "yaml",
vue: "vue", vue: "vue",
angular: "angular",
} }
export default { export default {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册