Skip to content

Instantly share code, notes, and snippets.

View Alex-xd's full-sized avatar

Alex Alex-xd

View GitHub Profile
<template>
<div class="app">
<div class="container">
<div class="main">
<el-checkbox v-model="checkAll" @change="handleCheckAllChange">全选</el-checkbox>
<virtual-list class="list" :size="30" :remain="6">
<div class="list-item" style="height:30px;" v-for="item in items" :key="item.idx">
<el-checkbox v-model="item.checked" @change="handleCheckItem(item)">table content</el-checkbox>
</div>
</virtual-list>
@Alex-xd
Alex-xd / cloudSettings
Last active March 2, 2022 07:10
Visual Studio Code Settings Sync Gist
{"lastUpload":"2022-03-02T07:09:57.499Z","extensionVersion":"v3.4.3"}
a.sort(function(a, b) {
return Math.random() - 0.5
});
@Alex-xd
Alex-xd / modular-template.js
Created January 17, 2017 13:33
A javscript template for writting a different modular specification library. 兼容各种模块化,优雅退化的模块化组件开发模板。
;(function (factory) {
var registeredInModuleLoader = false;
if (typeof define === 'function' && define.amd) {
define(factory); // AMD,requireJS
registeredInModuleLoader = true;
}
if (typeof exports === 'object') {
module.exports = factory(); // CMD Node,webpack,bowserfy,seaJS
registeredInModuleLoader = true;
}
@Alex-xd
Alex-xd / handleTime.js
Created January 13, 2017 08:33
处理毫秒级时间
// 处理毫秒级的时间
handleTime: function (times) {
var t = new Date(times);
return t.getFullYear() + '年' + (t.getMonth() + 1) + '月' + t.getDate() + '日 ' + t.toTimeString().slice(0, 5)
}
//2.处理毫秒级的时间
$.extend({
handleTime:function(times){
var nowTime = new Date(times),
year = nowTime.getFullYear(),
month = nowTime.getMonth(),
day = nowTime.getDate();
return year+'.'+month+"."+day;
function debounce(dom, event, fn, timeout) {
var timeout = timeout || 3; // 默认延迟3s内点击无效
var timer = null;
// cornor cases
if (!dom || !event || !(event in dom) || typeof fn !== 'function') {
return
}
dom.addEventListener(event, function () {
var _this = this;
@Alex-xd
Alex-xd / escapeHTML.js
Created January 6, 2017 15:51
转义HTML
function escapeHTML(a) {
a = "" + a;
return a.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&apos;");
;
}
@Alex-xd
Alex-xd / requestAnimationFrame.js
Last active December 30, 2016 17:44
JS动画
(function() {
var lastTime = 0;
var vendors = ['webkit', 'moz'];
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
window.cancelAnimationFrame =
window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
}
if (!window.requestAnimationFrame)
/*
DOM结构说明:
ul.avatar-list
li
img.avatar
li
img.avatar
*/
.avatar-list > li:nth-child(3n+2) img {
border-top-left-radius: 84%;