分享 一个类似 ps 辅助线功能

效果图片:

提示:这里的样式我做边做了修改,根据个人情况而定。

//你也可以npm下载
$ npm install --save vue-ruler-tool

在这里插入图片描述

特点

  • 没有依赖
  • 可拖动的辅助线
  • 快捷键支持

开始使用 1. even.js

/**
 * @description 绑定事件 on(element, event, handler)
 */
export const on = (function () {
    if ((document.addEventListener)) {
        return function (element: any, event: any, handler: any) {
            if (element && event && handler) {
                element.addEventListener(event, handler, false)
            }
        }
    } else {
        return function (element: any, event: string, handler: any) {
            if (element && event && handler) {
                element.attachEvent('on' + event, handler)
            }
        }
    }
})()

/**
 * @description 解绑事件 off(element, event, handler)
 */
export const off = (function () {
    if ((document.removeEventListener)) {
        return function (element: any, event: any, handler: any) {
            if (element && event) {
                element.removeEventListener(event, handler, false)
            }
        }
    } else {
        return function (element: any, event: string, handler: any) {
            if (element && event) {
                element.detachEvent('on' + event, handler)
            }
        }
    }
})()

组建rules代码:

提示:这里我运用的npm install

<template>
  <div :style="wrapperStyle" class="vue-ruler-wrapper" onselectstart="return false;" ref="el">
    <section v-show="rulerToggle">
      <div ref="horizontalRuler" class="vue-ruler-h" @mousedown.stop="horizontalDragRuler">
        <span
            v-for="(item,index) in xScale"
            :key="index"
            :style="{ left: index * 50 + 2 + 'px' }"
            class="n"
        >{{ item.id }}</span>
      </div>
      <div ref="verticalRuler" class="vue-ruler-v" @mousedown.stop="verticalDragRuler">
        <span
            v-for="(item,index) in yScale"
            :key="index"
            :style="{ top: index * 50 + 2 + 'px' }"
            class="n"
        >{{ item.id }}</span>
      </div>
      <div :style="{ top: verticalDottedTop + 'px' }" class="vue-ruler-ref-dot-h" />
      <div :style="{ left: horizontalDottedLeft + 'px' }" class="vue-ruler-ref-dot-v" />
      <div
          v-for="item in lineList"
          :title="item.title"
          :style="getLineStyle(item)"
          :key="item.id"
          :class="`vue-ruler-ref-line-${item.type}`"
          @mousedown="handleDragLine(item)"
      ></div>
    </section>
    <div ref="content" class="vue-ruler-content" :style="contentStyle">
      <slot />
    </div>
    <div v-show="isDrag" class="vue-ruler-content-mask"></div>
  </div>
</template>
<script lang="ts">
import { computed, defineComponent, onBeforeUnmount, onMounted, Ref, ref, watch } from 'vue';
import { on, off } from './event';
export default defineComponent({
  name: 'V3RulerComponent',
  props: {
    position: {
      type: String,
      default: 'relative',
      validator: (val: string) => {
        return ['absolute', 'fixed', 'relative', 'static', 'inherit'].indexOf(val) !== -1
      }
    }, // 规定元素的定位类型
    isHotKey: {
      type: Boolean, default: true
    }, // 热键开关
    isScaleRevise: {
      type: Boolean, default: false
    }, // 刻度修正(根据content进行刻度重置)
    value: {
      type: Array,
      default: () => {
        return [{ type: 'h', site: 50 }, { type: 'v', site: 180 }] //
      }
    }, // 预置参考线
    contentLayout: {
      type: Object,
      default: () => {
        return { top: 0, left: 0 }
      }
    }, // 内容部分布局
    parent: {
      type: Boolean,
      default: false
    },
    visible: {
      type: Boolean,
      default: true
    },
    stepLength: {
      type: Number,
      default: 50,
      validator: (val: number) => val % 10 === 0
    } // 步长
  },
  setup(props, context) {
    const size = 17;
    let left_top = 18;//18 内容左上填充
    let windowWidth = ref(0); // 窗口宽度
    let windowHeight = ref(0); // 窗口高度
    let xScale = ref<[{id:number}]>([{id:0}]); // 水平刻度
    let yScale= ref<[{id:number}]>([{id:0}]); // 垂直刻度
    let topSpacing = 0; // 标尺与窗口上间距
    let leftSpacing = 0; //  标尺与窗口左间距
    let isDrag = ref(false);
    let dragFlag = ''; // 拖动开始标记,可能值x(从水平标尺开始拖动);y(从垂直标尺开始拖动)
    let horizontalDottedLeft = ref(-999); // 水平虚线位置
    let verticalDottedTop = ref(-999); // 垂直虚线位置
    let rulerWidth = 0; // 垂直标尺的宽度
    let rulerHeight = 0; // 水平标尺的高度
    let dragLineId = ''; // 被移动线的ID
    //ref
    const content = ref(null);
    const el = ref(null);
    const verticalRuler = ref(null);
    const horizontalRuler = ref(null);

    const keyCode = {
      r: 82
    }; // 快捷键参数
    let rulerToggle = ref(true); // 标尺辅助线显示开关
    const wrapperStyle:any = computed(() => {
      return {
        width: windowWidth.value + 'px',
        height: windowHeight.value + 'px',
        position: props.position
      }
    });
    const contentStyle = computed(() => {
      // padding: left_top + 'px 0px 0px ' + left_top + 'px'
      return {
        left: props.contentLayout.left + 'px',
        top: props.contentLayout.top + 'px',
        padding: left_top + 'px 0px 0px 0px'
      }
    });
    const lineList = computed(() => {
      let hCount = 0;
      let vCount = 0;
      return props.value.map((item: any) => {
        const isH = item.type === 'h'
        return {
          id: `${item.type}_${isH ? hCount++ : vCount++}`,
          type: item.type,
          title: item.site.toFixed(2) + 'px',
          [isH ? 'top' : 'left']: item.site / (props.stepLength / 50) + size
        }
      })
    });
    watch(() => props.visible, (visible: any) => {
      rulerToggle.value = visible;
    }, {
      immediate: true
    });
    onMounted(() => {
      on(document, 'mousemove', dottedLineMove)
      on(document, 'mouseup', dottedLineUp)
      on(document, 'keyup', keyboard)
      init()
      on(window, 'resize', windowResize)
    });
    onBeforeUnmount(() => {
      off(document, 'mousemove', dottedLineMove)
      off(document, 'mouseup', dottedLineUp)
      off(document, 'keyup', keyboard)
      off(window, 'resize', windowResize)
    });
    //function
    const init = (() => {
      box()
      scaleCalc()
    });

    const windowResize = (() => {
      xScale.value = [{id:0}]
      yScale.value = [{id:0}]
      init()
    });
    const getLineStyle = (({ type, top, left }: any) => {
      return type === 'h' ? { top: top + 'px' } : { left: left + 'px' }
    });
    const handleDragLine = (({ type, id }: any) => {
      return type === 'h' ? dragHorizontalLine(id) : dragVerticalLine(id)
    });
    //获取窗口宽与高
    const box = (() => {
      if (props.isScaleRevise) { // 根据内容部分进行刻度修正
        const contentLeft = (content.value as any).offsetLeft
        const contentTop = (content.value as any).offsetTop
        getCalcRevise(xScale.value, contentLeft)
        getCalcRevise(yScale.value, contentTop)
      }
      if (props.parent) {
        const style = window.getComputedStyle((el.value as any).parentNode, null);
        windowWidth.value = parseInt(style.getPropertyValue('width'), 10);
        windowHeight.value = parseInt(style.getPropertyValue('height'), 10);
      } else {
        windowWidth.value = document.documentElement.clientWidth - leftSpacing
        windowHeight.value = document.documentElement.clientHeight - topSpacing
      }
      rulerWidth = (verticalRuler.value as any).clientWidth;
      rulerHeight = (horizontalRuler.value as any).clientHeight;
      setSpacing()
    });
    const setSpacing = (() => {
      topSpacing = (horizontalRuler.value as any).getBoundingClientRect().y //.offsetParent.offsetTop
      leftSpacing = (verticalRuler.value as any).getBoundingClientRect().x// .offsetParent.offsetLeft
    });
    // 计算刻度
    const scaleCalc = (() => {
      getCalc(xScale.value, windowWidth.value);
      getCalc(yScale.value, windowHeight.value);
    });

    //获取刻度
    const getCalc = ((array: [{id:number}], length: any) => {
      for (let i = 0; i < length * props.stepLength / 50; i += props.stepLength) {
        if (i % props.stepLength === 0) {
          array.push({ id: i })
        }
      }
    });
    // 获取矫正刻度方法
    const getCalcRevise = ((array: [{id:number}], length: any) => {
      for (let i = 0; i < length; i += 1) {
        if (i % props.stepLength === 0 && i + props.stepLength <= length) {
          array.push({ id: i })
        }
      }
    });
    //生成一个参考线
    const newLine = ((val: any) => {
      isDrag.value = true
      dragFlag = val
    });
    //虚线移动
    const dottedLineMove = (($event: any) => {
      setSpacing()
      switch (dragFlag) {
        case 'x':
          if (isDrag.value) {
            verticalDottedTop.value = $event.pageY - topSpacing
          }
          break
        case 'y':
          if (isDrag.value) {
            horizontalDottedLeft.value = $event.pageX - leftSpacing
          }
          break
        case 'h':
          if (isDrag.value) {
            verticalDottedTop.value = $event.pageY - topSpacing
          }
          break
        case 'v':
          if (isDrag.value) {
            horizontalDottedLeft.value = $event.pageX - leftSpacing
          }
          break
        default:
          break
      }
    });
    //虚线松开
    const dottedLineUp = (($event: any) => {
      setSpacing()
      if (isDrag.value) {
        isDrag.value = false
        const cloneList = JSON.parse(JSON.stringify(props.value))
        switch (dragFlag) {
          case 'x':
            cloneList.push({
              type: 'h',
              site: ($event.pageY - topSpacing - size) * (props.stepLength / 50)
            })
            context.emit('input', cloneList);
            break
          case 'y':
            cloneList.push({
              type: 'v',
              site: ($event.pageX - leftSpacing - size) * (props.stepLength / 50)
            })
            context.emit('input', cloneList);
            break
          case 'h':
            dragCalc(cloneList, $event.pageY, topSpacing, rulerHeight, 'h')
            context.emit('input', cloneList);
            break
          case 'v':
            dragCalc(cloneList, $event.pageX, leftSpacing, rulerWidth, 'v')
            context.emit('input', cloneList);
            break
          default:
            break
        }
        verticalDottedTop.value = horizontalDottedLeft.value = -10
      }
    });
    const dragCalc = ((list: any, page: any, spacing: any, ruler: any, type: any) => {
      if (page - spacing < ruler) {
        let Index, id
        lineList.value.forEach((item: any, index: any) => {
          if (item.id === dragLineId) {
            Index = index
            id = item.id
          }
        })
        list.splice(Index, 1, {
          type: type,
          site: -600
        })
      } else {
        let Index, id
        lineList.value.forEach((item, index) => {
          if (item.id === dragLineId) {
            Index = index
            id = item.id
          }
        })
        list.splice(Index, 1, {
          type: type,
          site: (page - spacing - size) * (props.stepLength / 50)
        })
      }
    });
    //水平标尺按下鼠标
    const horizontalDragRuler = (() => {
      newLine('x')
    });
    //垂直标尺按下鼠标
    const verticalDragRuler = (() => {
      newLine('y')
    });
    // 水平线处按下鼠标
    const dragHorizontalLine = ((id: any) => {
      isDrag.value = true
      dragFlag = 'h'
      dragLineId = id
    });
    // 垂直线处按下鼠标
    const dragVerticalLine = ((id: any) => {
      isDrag.value = true
      dragFlag = 'v'
      dragLineId = id
    });
    //键盘事件
    const keyboard = (($event: any) => {
      if (props.isHotKey) {
        switch ($event.keyCode) {
          case keyCode.r:
            rulerToggle.value = !rulerToggle.value
            context.emit('update:visible', rulerToggle.value)
            if (rulerToggle.value) {
              left_top = 18 ;//18
            } else {
              left_top = 0;
            }
            break
        }
      }
    });
    return {
      wrapperStyle, rulerToggle, horizontalDragRuler, xScale, verticalDragRuler, yScale, verticalDottedTop, horizontalDottedLeft, lineList, getLineStyle
      , handleDragLine, contentStyle, isDrag, content, el, verticalRuler, horizontalRuler
    };
  },
})
</script>
<style lang="scss">
.vue-ruler{
  &-wrapper {
    left: 0;
    top: 0;
    z-index: 999;
    overflow: hidden;
    user-select: none;
  }
  &-h,
  &-v,
  &-ref-line-v,
  &-ref-line-h,
  &-ref-dot-h,
  &-ref-dot-v {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    z-index: 999;
  }
  &-h,
  &-v,
  &-ref-line-v,
  &-ref-line-h,
  &-ref-dot-h,
  &-ref-dot-v {
    position: absolute;
    left: 0;
    top: 0;
    overflow: hidden;
    z-index: 999;
  }

  &-h {
    width: 100%;
    height: 18px;
    left: 18px;
    opacity: 0.6;
    //background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAASCAMAAAAuTX21AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRFMzMzAAAABqjYlAAAACNJREFUeNpiYCAdMDKRCka1jGoBA2JZZGshiaCXFpIBQIABAAplBkCmQpujAAAAAElFTkSuQmCC)
    //repeat-x; /*./image/ruler_h.png*/

    background-image: repeating-linear-gradient(to right, #656565 0, #656565 0.05em, transparent 0, transparent 4em), repeating-linear-gradient(to right, #656565 0, #656565 0.05em, transparent 0, transparent 2em), repeating-linear-gradient(to right, #656565 0, #656565 0.05em, transparent 0, transparent 1em);
    //background-size: 100% 10px, 100% 6px, 100% 4px;
    //background-repeat: no-repeat;
    //background-position: 0.05em 100%, 0.05em 100%, 0.05em 100%;
    background-size: 100% 18px, 100% 7px,100% 7px;
    background-repeat: no-repeat;
    background-position: 100% 0.05em , 100% 0.05em ,100% 0.05em;
    //border-bottom: 1px solid #656565;
  }

  &-v {
    width: 18px;
    height: 100%;
    top: 18px;
    opacity: 0.6;
    //background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAyCAMAAABmvHtTAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAlQTFRFMzMzAAAABqjYlAAAACBJREFUeNpiYGBEBwwMTGiAakI0NX7U9aOuHyGuBwgwAH6bBkAR6jkzAAAAAElFTkSuQmCC)
    //repeat-y; /*./image/ruler_v.png*/
    background-image: repeating-linear-gradient(to bottom, #656565 0, #656565 0.05em, transparent 0, transparent 4em), repeating-linear-gradient(to bottom, #656565 0, #656565 0.05em, transparent 0, transparent 2em), repeating-linear-gradient(to bottom, #656565 0, #656565 0.05em, transparent 0, transparent 1em);
    background-size: 18px 100%, 7px 100% , 7px 100%;
    background-repeat: no-repeat;
    background-position: 0.05em 100%, 0.05em 100%, 0.05em 100%;
    //border-bottom: 1px solid #656565;
  }

  &-v .n,
  &-h .n {
    position: absolute;
    font: 10px/1 Arial, sans-serif;
    color: transparent;
    cursor: default;
  }

  &-v .n {
    width: 8px;
    left: 3px;
    word-wrap: break-word;
  }

  &-h .n {
    top: 1px;
  }

  &-ref-line-v,
  &-ref-line-h,
  &-ref-dot-h,
  &-ref-dot-v {
    z-index: 998;
  }

  &-ref-line-h {
    width: 100%;
    height: 3px;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAABCAMAAADU3h9xAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFSv//AAAAH8VRuAAAAA5JREFUeNpiYIACgAADAAAJAAE0lmO3AAAAAElFTkSuQmCC)
    repeat-x left center; /*./image/line_h.png*/
    cursor: n-resize; /*url(./image/cur_move_h.cur), move*/
  }

  &-ref-line-v {
    width: 3px;
    height: 100%;
    _height: 9999px;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAICAMAAAAPxGVzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFSv//AAAAH8VRuAAAAA5JREFUeNpiYEAFAAEGAAAQAAGePof9AAAAAElFTkSuQmCC)
    repeat-y center top; /*./image/line_v.png*/
    cursor: w-resize; /*url(./image/cur_move_v.cur), move*/
  }

  &-ref-dot-h {
    width: 100%;
    height: 3px;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAMAAABFaP0WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFf39/F3PnHQAAAAJ0Uk5T/wDltzBKAAAAEElEQVR42mJgYGRgZAQIMAAADQAExkizYQAAAABJRU5ErkJggg==)
    repeat-x left 1px; /*./image/line_dot.png*/
    cursor: n-resize; /*url(./image/cur_move_h.cur), move*/
    top: -10px;
  }

  &-ref-dot-v {
    width: 3px;
    height: 100%;
    _height: 9999px;
    background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAMAAABFaP0WAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAZQTFRFf39/F3PnHQAAAAJ0Uk5T/wDltzBKAAAAEElEQVR42mJgYGRgZAQIMAAADQAExkizYQAAAABJRU5ErkJggg==)
    repeat-y 1px top; /*./image/line_dot.png*/
    cursor: w-resize; /*url(./image/cur_move_v.cur), move*/
    left: -10px;
  }
  &-content {
    position: absolute;
    z-index: 997;
  }
  &-content-mask{
    position: absolute;
    width: 100%;
    height: 100%;
    background: transparent;
    z-index: 998;
  }
}
</style>

使用组建:

提示:这里可以添加计划学习的时间

 <Rules :style="`width:${canvasStyle.width}px;`"
            :value="presetLine"
            :is-hot-key="true"
            :step-length="50"
            :parent="true"
            :is-scale-revise="true"
            :visible.sync="rulesVisible"
            @input="cloneList"
        >
  //内容部分
 </Rules>
  //是否显示/隐藏
  let rulesVisible = ref(false);
  //默认辅助线
  let presetLine = ref([{ type: 'h', site: 200 }, { type: 'v', site: 100 }]);
  //获取辅助线
  const cloneList = (list:any)=>{
    presetLine.value = list ;
    console.log("cloneList",list)
    console.log("presetLine",presetLine.value )
  }

总结:

还有一种 我个人感觉也挺好的,地址放在这里了,需要的可以试试:http://mark-rolich.github.io/RulersGuides.js/

npm i ruler-guides

效果图我也给你们放在下方了:
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/57384.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

FPGA项目设计:数字时钟

项目要求&#xff1a; 设计一个数字时钟&#xff0c;数码管前两位显示小时&#xff0c;数码管中间两位显示分钟&#xff0c;数码管后面两位显示秒。 项目设计&#xff1a; 系统框架图&#xff1a; 计数模块时序图&#xff1a; 代码实现&#xff1a; 计数模块&#xff1a; /…

举个栗子~Quick BI 技巧(2):创建柱线组合图

上一期举个栗子为数据粉们分享了如何简单几步创建趋势折线图&#xff0c;有一些数据粉发来疑问&#xff1a;如何利用 Quick BI 制作柱线图呢&#xff1f; 线柱图是一种非常重要且常用的组合图表&#xff0c;可以将两组数据在同一个表中直观的表达。今天的栗子&#xff0c;我们…

什么是头脑风暴法,有哪些原则?

1. 什么是头脑风暴法&#xff1f; 头脑风暴法&#xff08;Brainstorming&#xff09;是一种用于创造性思维和问题解决的方法。它旨在通过集体讨论和思维碰撞&#xff0c;激发团队成员的创造力和想象力&#xff0c;从而产生新的创意和解决方案。 在头脑风暴会议中&#xff…

【项目方案】OpenAI流式请求实现方案

文章目录 实现目的效果比对非stream模式stream模式实现方案方案思路总体描述前端方案对比event-source-polyfill代码示例前端实现遇到的问题与解决方法后端参考资料时序图关键代码示例后端实现时遇到的问题与解决方法实现目的 stream是OpenAI API中的一个参数,用于控制请求的…

Dockerfile构建Tomcat镜像(源码)

Dockerfile构建Tomcat镜像 目录 Dockerfile构建Tomcat镜像 1、建立工作目录 2、编写Dockerfile文件 3、构建镜像 4、测试容器 5、浏览器访问测试&#xff1a; 1、建立工作目录 [roothuyang1 ~]# mkdir tomcat[roothuyang1 ~]# cd tomcat/[roothuyang1 tomcat]# lsapach…

了解垃圾回收算法

点击下方关注我&#xff0c;然后右上角点击...“设为星标”&#xff0c;就能第一时间收到更新推送啦~~~ 垃圾回收&#xff08;Garbage Collect&#xff09;是Java语言中的一种自动内存管理机制&#xff0c;用于自动回收不再使用的对象所占用的内存空间。Java虚拟机会自动追踪和…

C# Microsoft消息队列服务器的使用 MSMQ

先安装消息队列服务器 private static readonly string path ".\\Private$\\myQueue";private void Create(){if (!MessageQueue.Exists(path)){MessageQueue.Create(path);}}private void Send(){Stopwatch stopwatch new Stopwatch();stopwatch.Start();Message…

【爬虫逆向案例】某易云音乐(评论)js逆向—— params、encSecKey解密

声明&#xff1a;本文只作学习研究&#xff0c;禁止用于非法用途&#xff0c;否则后果自负&#xff0c;如有侵权&#xff0c;请告知删除&#xff0c;谢谢&#xff01; 【爬虫逆向案例】某易云音乐&#xff08;评论&#xff09;js逆向—— params、encSecKey解密 1、前言2、行动…

国标GB28181安防视频平台EasyGBS大批量通道接入后,创建角色接口未响应的排查

国标GB28181协议视频平台EasyGBS是基于国标GB28181协议的视频云服务平台&#xff0c;支持多路设备同时接入&#xff0c;并对多平台、多终端分发出RTSP、RTMP、FLV、HLS、WebRTC等格式的视频流。平台可提供视频监控直播、云端录像、云存储、检索回放、智能告警、语音对讲、平台级…

Python 一篇入门

目录 Python 的简介与特点 Python支持多种编程风格 解释运行 跨平台 可扩展强 可嵌入 丰富的库 Python版本选择 Python开发环境搭建 认识Python解释器 快速入门 变量和赋值 动态类型 变量命名规则 认识 "数字" 认识 "字符串" 认识 "…

TSINGSEE青犀视频汇聚平台EasyCVR视频广场面包屑侧边栏支持拖拽操作

TSINGSEE青犀视频汇聚平台EasyCVR可拓展性强、视频能力灵活、部署轻快&#xff0c;可支持的主流标准协议有GB28181、RTSP/Onvif、RTMP等&#xff0c;以及厂家私有协议与SDK接入&#xff0c;包括海康Ehome、海大宇等设备的SDK等&#xff0c;能对外分发RTSP、RTMP、FLV、HLS、Web…

mysql 、sql server 常见的区别

&#xff2e;&#xff35;&#xff2c;&#xff2c;   处理 MySQL IFNULL(col , val) SQL Server ISNULL(col,val) 表名、列名等 一般不推荐用保留字 &#xff0c;如果非要保留字 MySQL 用用着重号&#xff0c;即 反引号 包括 select col from GROUP SQL Server 用用着重号…

【GO】go语言入门实战 —— 命令行在线词典

文章目录 程序介绍抓包代码生成生成request body解析respond body完整代码 字节青训营基础班学习记录。 程序介绍 在运行程序的时候以命令行的形式输入要查询的单词&#xff0c;然后程序返回单词的音标、释义等信息。 示例如下&#xff1a; 抓包 我们选择与网站https://fany…

Docker Compose 使用方法

目录 前言 安装 Docker Compose Ubuntu 安装与更新 Red Hat 安装与更新 验证是否安装 Docker Compose 创建 docker-compose.yml 文件 创建一个MySQL 与 tomcat 示例 使用Docker Compose启动服务 前言 Docker Compose 是一个工具&#xff0c;旨在帮助定义和 共享多容器…

Vue如何做一个左边栏

要求一-------点击之后能够实现页面跳转,使用router&#xff0c;点击之后跳到指定页面&#xff1a; 第二步&#xff1a;如何实现简易的前端路由 第三步 左侧边栏的正确写法&#xff0c;ul中li套router-link 第四步 实现嵌套路由 第五步 ul中嵌套着li 第六步嵌套路由 第七步&…

Navidrome - 开源音乐服务器【打造属于自己的音乐播放器】「端口映射」随时随地想听就听

转载自cpolar极点云文章&#xff1a;Navidrome - 开源音乐服务器【打造属于自己的音乐播放器】「端口映射」随时随地想听就听 1. 前言 不知从何时开始&#xff0c;我们能用的音乐软件越来越少&#xff0c;笔者使用小米手机很久了&#xff0c;自从小米手机的自带音乐播放器变成…

MIAOYUN获评“2023年度一云多芯稳定安全运行优秀案例”

2023年7月25日至26日&#xff0c;由中国信息通信研究院&#xff08;简称“中国信通院”&#xff09;、中国通信标准化协会主办的以“云领创新&#xff0c;算启新篇”为主题的“2023可信云大会”在北京成功举办。会上公布了多项前瞻领域的评估结果和2023年度最佳实践案例&#x…

浅析视频技术与AI智能感知与生鲜供应链的数字化应用

一、行业背景 近年来&#xff0c;我国肉类、水果、蔬菜、水产品、乳品、速冻食品等生鲜市场需求快速增长&#xff0c;营商环境持续改善&#xff0c;推动冷链物流较快发展&#xff0c;但仍面临不少突出瓶颈和痛点难点卡点问题&#xff0c;难以有效满足市场需求。传统生鲜食材供…

公司植物日常护养方法备忘录

植物为我们净化空气&#xff0c;美化环境&#xff0c;我们要按照科学的经验照顾好它们。公司植物日常通用护养方法如下&#xff1a; 首先剪掉已经枯黄的部分。 需要晒太阳的植物按时搬到外面晒太阳&#xff0c;每次晒1到2个小时。 所有植物统一在每个月的20号左右施肥一次&am…

docker logs 使用说明

docker logs 可以查看某个容器内的日志情况。 前置参数说明 c_name容器名称 / 容器ID logs 获取容器的日志 , 命令如下&#xff1a; docker logs [options] c_name option参数&#xff1a; -n 查看最近多少条记录&#xff1a;docker logs -n 5 c_name--tail与-n 一样 &#…