当前位置: 首页 > news >正文

国内家居行业网站开发高性能网站建设指南 京东

国内家居行业网站开发,高性能网站建设指南 京东,阳谷网页设计,wordpress手机端边侧航栏1、效果图 输入代码,点击格式化就出现以上效果,再点击压缩,是以下效果2、安装 npm i vue3-ace-editor 3、使用 新建aceConfig.js文件 // ace配置,使用动态加载来避免第一次加载开销 import ace from ace-builds// 导入不同的主…

1、效果图

输入代码,点击格式化就出现以上效果,再点击压缩,是以下效果
2、安装

npm i vue3-ace-editor

3、使用

新建aceConfig.js文件

// ace配置,使用动态加载来避免第一次加载开销
import ace from 'ace-builds'// 导入不同的主题模块,并设置对应 URL
import themeGithubUrl from 'ace-builds/src-noconflict/theme-github?url'
ace.config.setModuleUrl('ace/theme/github', themeGithubUrl)import themeChromeUrl from 'ace-builds/src-noconflict/theme-chrome?url'
ace.config.setModuleUrl('ace/theme/chrome', themeChromeUrl)import themeMonokaiUrl from 'ace-builds/src-noconflict/theme-monokai?url'
ace.config.setModuleUrl('ace/theme/monokai', themeMonokaiUrl)// 导入不同语言的语法模式模块,并设置对应 URL (所有支持的主题和模式:node_modules/ace-builds/src-noconflict)
import modeJsonUrl from 'ace-builds/src-noconflict/mode-json?url'
ace.config.setModuleUrl('ace/mode/json', modeJsonUrl)import modeJavascriptUrl from 'ace-builds/src-noconflict/mode-javascript?url'
ace.config.setModuleUrl('ace/mode/javascript', modeJavascriptUrl)import modeHtmlUrl from 'ace-builds/src-noconflict/mode-html?url'
ace.config.setModuleUrl('ace/mode/html', modeHtmlUrl)import modePythonUrl from 'ace-builds/src-noconflict/mode-python?url'
ace.config.setModuleUrl('ace/mode/yaml', modePythonUrl)// 用于完成语法检查、代码提示、自动补全等代码编辑功能,必须注册模块 ace/mode/lang _ worker,并设置选项 useWorker: true
import workerBaseUrl from 'ace-builds/src-noconflict/worker-base?url'
ace.config.setModuleUrl('ace/mode/base', workerBaseUrl)import workerJsonUrl from 'ace-builds/src-noconflict/worker-json?url' // for vite
ace.config.setModuleUrl('ace/mode/json_worker', workerJsonUrl)import workerJavascriptUrl from 'ace-builds/src-noconflict/worker-javascript?url'
ace.config.setModuleUrl('ace/mode/javascript_worker', workerJavascriptUrl)import workerHtmlUrl from 'ace-builds/src-noconflict/worker-html?url'
ace.config.setModuleUrl('ace/mode/html_worker', workerHtmlUrl)// 导入不同语言的代码片段,提供代码自动补全和代码块功能
import snippetsJsonUrl from 'ace-builds/src-noconflict/snippets/json?url'
ace.config.setModuleUrl('ace/snippets/json', snippetsJsonUrl)import snippetsJsUrl from 'ace-builds/src-noconflict/snippets/javascript?url'
ace.config.setModuleUrl('ace/snippets/javascript', snippetsJsUrl)import snippetsHtmlUrl from 'ace-builds/src-noconflict/snippets/html?url'
ace.config.setModuleUrl('ace/snippets/html', snippetsHtmlUrl)import snippetsPyhontUrl from 'ace-builds/src-noconflict/snippets/python?url'
ace.config.setModuleUrl('ace/snippets/javascript', snippetsPyhontUrl)// 启用自动补全等高级编辑支持,
import extSearchboxUrl from 'ace-builds/src-noconflict/ext-searchbox?url'
ace.config.setModuleUrl('ace/ext/searchbox', extSearchboxUrl)// 启用自动补全等高级编辑支持
import 'ace-builds/src-noconflict/ext-language_tools'
ace.require('ace/ext/language_tools')

4、在页面使用

<template><div><div class="flex justify-between mb-2"><el-tag color="#eff0ff" effect="light">json</el-tag><div><el-button color="#8769db" size="small" @click="jsonFormat">{{ $t('format') }}</el-button><el-button size="small" @click="jsonNoFormat">{{ $t('zip') }}</el-button></div></div><v-ace-editorv-model:value="content"lang="json"theme="chrome":options="options"class="w-full text-base pt-5":readonly="options.readOnly"/></div>
</template><script lang="ts" setup>
import { ref, reactive, watch } from 'vue'
import emitter from '@/utils/emitter'
import { VAceEditor } from 'vue3-ace-editor'
import './aceConfig.js'const content = ref('') // 显示的内容const options = reactive({useWorker: true, // 启用语法检查,必须为trueenableBasicAutocompletion: true, // 自动补全enableLiveAutocompletion: true, // 智能补全enableSnippets: true, // 启用代码段showPrintMargin: false, // 去掉灰色的线,printMarginColumnhighlightActiveLine: false, // 高亮行highlightSelectedWord: true, // 高亮选中的字符tabSize: 4, // tab锁进字符fontSize: 14, // 设置字号wrap: false, // 是否换行readOnly: false, // 是否可编辑minLines: 1, // 最小行数,minLines和maxLines同时设置之后,可以不用给editor再设置高度maxLines: 50, // 最大行数
})// JSON格式化
const jsonFormat = () => {try {content.value = JSON.stringify(JSON.parse(content.value), null, 2)} catch (e) {jsonError(e)}
}// JSON压缩
const jsonNoFormat = () => {try {content.value = JSON.stringify(JSON.parse(content.value))} catch (e) {jsonError(e)}
}watch(() => content.value,(newContent) => {emitter.emit('handleCondition', newContent)},{ deep: true, immediate: true },
)const jsonError = (e: any) => {console.log(`JSON字符串错误:${e.message}`)
}
</script><style>
.ace_gutter {background-color: transparent !important;
}
.ace-chrome .ace_gutter-active-line {background-color: transparent !important;
}
</style>

参考:vue3-ace-editor使用记录-CSDN博客

http://www.yayakq.cn/news/343419/

相关文章:

  • 龙泉驿区建设局网站wordpress界面英文版
  • 新建网站如何推广做网站手机适配需要加价吗
  • 辽阳专业网站开发公司wordpress做的网站吗
  • 保定企业自助建站开源php建站系统
  • 怎么样注册网站动漫网站建设意义
  • 十大免费网站免费下载软件建设项目环境影响备案网站
  • 微网站建设教程视频教程旅游网站网页设计方案
  • 最适合seo的网站源码苏州有实力的软件开发公司
  • 给人做违法网站规避网站设计毕业设计论文
  • 绵阳做最好优化网站的天津的网站建设
  • 如何在各个购物网站之间做差价o2o苗木网站建设
  • 做电路方案设计的网站网站都需要续费
  • 提升网站打开速度怎么做创新的手机网站建设
  • 外部调用wordpress站点文章企业网站开发工具
  • 麻涌做网站如何建立网站数据库连接
  • 网站买卖交易平台平面广告设计好学吗
  • 做百度移动端网站汉中360网站建设
  • 贵州网站制作公司电话无锡网络营销平台
  • 定制 网站开发 价格wordpress template name
  • 青岛网站建设seo优化炫酷网站推荐
  • 2019做网站龙岗网站建设哪家好
  • 搜索引擎营销的基本过程泰安网站建设优化案例报告
  • seo网络贸易网站推广有限公司注册资金最低多少
  • 免费站长工具纪梵希网站设计分析
  • 购物网站为什么做移动端南昌p2p网站建设公司
  • 图片上传 网站建设教学视频教程厦门建设局官网电话
  • 网站集约化建设的好处企业网站建设规划设计任务书
  • 电子商务网站建设与运营网站产品整合推广
  • 网站设计书的结构江苏省建设厅网站建造师栏
  • c 做网站目前网络推广平台