Skip to content

Instantly share code, notes, and snippets.

View sunzsh's full-sized avatar

小山 sunzsh

View GitHub Profile
@sunzsh
sunzsh / fix-zoom.js
Created December 29, 2023 15:37
解决代码修改了网页zoom导致各种popover错位的问题(适配vue2+elementUI)
export default {
install(Vue) {
const delegates = {
'el-select': (component, element) => {
return [component.$refs.reference.$el]
},
'el-pagination': (component, element) => {
const sizesComponent = component.$children.find((child) => child.$options._componentTag === 'sizes');
const eles_ElSelectInSizes = delegates['el-select'](sizesComponent.$children[0], element);
"editor.renderFinalNewline": "dimmed",
"workbench.colorCustomizations": {
"editorLineNumber.foreground": "#222",
"editorLineNumber.activeForeground": "#666",
"editorLineNumber.dimmedForeground": "#111",
"editorIndentGuide.background": "#222",
"editorIndentGuide.activeBackground": "#666",
"editor.lineHighlightBackground": "#111", //修改光标所在行的背景色
"editor.lineHighlightBorder": "#333", //修改光标所在行的边框色
"editor.wordHighlightBorder": "#e4893995"
@sunzsh
sunzsh / 系统当前选中文件路径.applescript
Last active December 7, 2023 06:20
alfred获取当前选中的文件路径
on run
tell application "Finder" to set aliasItemName to selection as alias
set posixPathName to POSIX path of aliasItemName
return posixPathName
end run
@sunzsh
sunzsh / v-drag.js
Created December 1, 2022 13:43
v-drag指令
Vue.directive('drag', (el) => {
const oDiv = el // 当前元素
const minTop = oDiv.getAttribute('drag-min-top')
const ifMoveSizeArea = 20
oDiv.onmousedown = e => {
let target = oDiv
while (window.getComputedStyle(target).position !== 'absolute' && target !== document.body) {
target = target.parentElement
}
@sunzsh
sunzsh / flex-transition-demo.html
Created October 15, 2022 14:01
全屏折叠面板demo
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body, html {
height: 100%;
<style>
@keyframes shake {
10%,
90% {
transform: translate3d(-1px, 0, 0);
}
20%,
80% {
transform: translate3d(2px, 0, 0);
@sunzsh
sunzsh / msgboxSlider.js
Created August 21, 2022 12:49
利用带slider的弹框修改数字
import Vue from 'vue'
function msgboxSlider(vue, options = { }) {
let sliderPropsFin = Object.assign({ value: 0, min: 0, max: 100, step: 1, showInput: true }, options.slider);
let currentValue = sliderPropsFin.value;
const content = vue.$createElement('el-slider',
{
style: { width: '380px' },
props: sliderPropsFin,
on: {
@sunzsh
sunzsh / Promise.java
Last active December 28, 2022 09:33
Java仿Js实现Promise.all实现并行处理的能力
package com.example.demo.util;
import java.util.concurrent.*;
public class Promise {
// 根据实际情况配置线程池
static ExecutorService threadPool = new ThreadPoolExecutor(10, 40, 20, TimeUnit.SECONDS, new ArrayBlockingQueue<>(2000), Executors.defaultThreadFactory(), new ThreadPoolExecutor.AbortPolicy());
public static void allAwait(Runnable ...runnables) throws InterruptedException {
@sunzsh
sunzsh / el-table3.vue
Last active June 19, 2023 05:51
带分页打印表头的el-table
<script>
import { Table } from 'element-ui';
export default {
extends: Table,
mounted() {
this.$nextTick(function () {
let thead = this.$el.querySelector('.el-table__header-wrapper thead');
let theadNew = thead.cloneNode(true);
this.$el.querySelector('.el-table__body-wrapper table').appendChild(theadNew);
})
import java.util.Iterator;
import java.util.Objects;
import java.util.concurrent.*;
import java.util.function.Consumer;
import java.util.function.Function;
/**
* @author sunzsh
* @param <T> 延迟业务数据的类型
*/