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

asp网站开发实例书籍如何给一个网站做优化

asp网站开发实例书籍,如何给一个网站做优化,网站建设模式怎么写,硅谷电视剧他们做的是网站还是软件前言 程序员用到IDE次数比较频繁#xff0c;比如vscode、idea等#xff0c;这些都是市场上比较流行的代码编辑器#xff0c;拥有非常全面的功能。但是有时候在项目开发上也会用到代码编辑器#xff0c;比如复杂的ArrayObject输入#xff0c;或者需要用到用户交互…前言 程序员用到IDE次数比较频繁比如vscode、idea等这些都是市场上比较流行的代码编辑器拥有非常全面的功能。但是有时候在项目开发上也会用到代码编辑器比如复杂的ArrayObject输入或者需要用到用户交互的代码逻辑或者需要用到json、yaml格式文件时的校验等等。本来也不了解只是接收到了项目需求于是开始慢慢了解以下为一点点实践不足之处敬请指出 官网链接 栗子 下载注意事项 vue2和vue3有专门的版本 vue2使用4/5以下的版本 vue3可使用6的版本 故不能使用 yarn add codemirror 他会安装最新的版本6 如果系统vue的版本为2故使用yarn add codemirror4 基本使用 文件引入 codemirror是基于javascript开发所以需要引入很多开发所需的js、css文件 vue-codemirror是一个vue组件按照组件的方式引入、注册即可 import { codemirror } from vue-codemirror; // require styles import codemirror/addon/fold/brace-fold; import codemirror/addon/fold/foldcode; import codemirror/addon/fold/foldgutter; import codemirror/addon/fold/foldgutter.css; import codemirror/lib/codemirror.css; import codemirror/mode/javascript/javascript; // JSON错误检查 import codemirror/addon/lint/lint.css; import codemirror/addon/lint/lint.js; // 需要依赖全局的jsonlint不是很优雅 import codemirror/addon/lint/json-lint.js; import codemirror/addon/lint/yaml-lint.js; //及时自动更新配置里面也需要设置autoRefresh为true import codemirror/addon/display/autorefresh; // 支持括号自动匹配 import codemirror/addon/edit/closebrackets.js; import codemirror/addon/edit/matchbrackets.js; // 引入dark主题 import codemirror/theme/duotone-dark.css;// 全屏 import codemirror/addon/display/fullscreen;引入json校验 // 引入jsonlint import jsonlint from jsonlint-mod;beforeCreate() {window.jsonlint jsonlint; },options配置 cmOptions: {mode: application/json, // 语言及语法模式theme: idea, // 主题autoRefresh: true, // 自动刷新line: true, // 显示函数lint: true, // 校验matchBrackets: true, // 括号匹配显示autoCloseBrackets: true, // 输入和退格时成对indentUnit: 2, // 缩进单位默认2lineWrapping: true, // 软换行tabSize: 4, // tab宽度lineNumbers: true, // 显示行数foldGutter: true,smartIndent: true, // 智能缩进gutters: [CodeMirror-linenumbers,CodeMirror-foldgutter,CodeMirror-lint-markers, // 实现语法报错], },code使用 一般code传入时是Array, Object, String 所以需要将他进行json.stringify序列化用2个空 格作为缩进 code: {handler(newVal) {const str newVal || [];this.newCode JSON.stringify(str, null, 2);},immediate: true, },高度自适应 this.$refs.cm.codemirror.setSize(100%, auto);设置代码只读 readOnly一般存在三种属性 true 不可编辑不可复制false 可编辑可复制nocursor 不可编辑可复制 this.$refs.cm.codemirror.setOption(readOnly, nocursor);高度计算 很多时候需要codemirror沾满剩余的高度有时候屏幕会涉及大小屏切换故涉及到元素监听高度自动计算功能主要使用ResizeObserver属性进行观察元素大小是否改变主要代码如下 created() {this.$nextTick(() {this.onResizeObserver();}); }, beforeDestroy() {const ele document.querySelector(.v-form);if (ele) {// 取消对class为v-form的元素进行观察this.resizeObserver.unobserve(ele);} }, methods: {onResizeObserver() {const _this this;this.resizeObserver new ResizeObserver((entries) {_this.setHeight(_this.reHeight);});// 在表单的情况下resize自动计算高度const ele document.querySelector(.v-form);if (ele) {// 对class为v-form的元素进行观察this.resizeObserver.observe(ele);}},// 高度计算setHeight(fn) {if (this.readOnly) {return;}const panelHeight document.querySelectorAll(.panel)[0].getBoundingClientRect().height;const headerHeight document.querySelectorAll(.panel-header)[1].getBoundingClientRect().height;const content document.querySelector(.content);const fontSize getComputedStyle(window.document.documentElement)[font-size].replace(px, );const num 1.8 * fontSize * 3;const contentHeight content.getBoundingClientRect().height - num;let height contentHeight - panelHeight - headerHeight - fn();// console.log(height, height)if (height 300) {height 300;}this.$nextTick(() {this.$refs.cm.codemirror.setSize(100%, height);});}, },栗子 https://codesandbox.io/s/vue-codemirror-json-editor-forked-yvf11d?file/src/components/JsonEditor.vue:185-229 大概实现了以下几个功能 json校验高度自动计算codemirror占满剩余高度高度自适应高度根据内容撑开代码只读readOnly主题切换代码自动更新 踩坑记录 [Vue warn]: Unknown custom element: - did you register the component correctly? For recursive components, make sure to provide the “name” option. 大概包括以下几种原因 import语句导入组件时from后面的路径写错注册组件时括号内的组件名称写错与import声明的不一致注册组件关键字components写错导致无法使用使用组件时名称写错与注册组件的名字不一致使用组件时没有使用 / 反斜杠结尾 codemirror初始化赋值无法显示问题 // 引入自动刷新文件 **import codemirror/addon/display/autorefresh**cmOptions: {// 语言及语法模式mode: application/json,// 主题theme: duotone-dark,**autoRefresh: true, // 自动刷新**// 显示函数line: true,lint: true, // 校验matchBrackets: true, // 括号匹配显示autoCloseBrackets: true, // 输入和退格时成对indentUnit: 2, // 缩进单位默认2// 软换行lineWrapping: true,// tab宽度tabSize: 4,lineNumbers: true,lineWrapping: true,foldGutter: true,gutters: [CodeMirror-linenumbers,CodeMirror-foldgutter,CodeMirror-lint-markers, // 实现语法报错], },参考文章 json格式校验 https://blog.51cto.com/u_15703146/5716514 https://www.cnblogs.com/proboxdu/p/16137537.html https://codesandbox.io/s/vue-codemirror-json-editor-forked-yvf11d codemirror文章 https://codemirror.net/
http://www.zqtcl.cn/news/598382/

相关文章:

  • 如何为一个网站做app手机软件大全
  • 哪家网络公司做网站工信部网站原来是
  • json取数据做网站asp网站 模板
  • 漳州做网站多少钱乐清网红餐厅
  • 淮安网站开发sem推广案例
  • 义乌网站建设郭云砺信息科技做网站
  • 重庆御临建筑公司官网网站更换域名seo
  • 北京大兴专业网站建设公司wordpress 加速乐
  • win7怎么做网站域名绑定邯郸最新通知今天
  • 苏州企业网站设计开发个人 网站备案
  • 威海哪有网站建设中国建设部网站失信名单
  • 重庆哪家在做网站建设php网站后台验证码不显示
  • 开发网站开票写什么google收录查询
  • dw做的网站如何上传图片服务器配置wordpress
  • 恩施网站优化七牛云可以做网站的存储空间吗
  • 网站建设的源代码有什么作用网站维护包括哪些
  • 广东广东网站建设工作网站qq登录 开发
  • 中山网页网站设计模板access 数据库做网站
  • 阿里云网站做网站的服务器用什么系统
  • 什么公司做网站最好怎么给网站做快照
  • 官方网站建设的方法有哪些方面邮箱号码大全
  • 电商app软件山东网络推广优化排名
  • 国内产品网站w源码1688网站关键词描述字数
  • 网站404 模板wordpress 文字插件下载
  • 河南民基建设工程有限公司网站齐齐哈尔建设局网站首页
  • 响应式网站建设推荐乐云践新三丰云免费云服务器
  • 长沙网站建设模板uc浏览器访问网站
  • 擼擼擼做最好的导航网站陕西政务服务网注册公司流程
  • 怎样做商城网站的推广wordpress用php哪个版本好
  • 网站功能模块建设建设网站考证