Skip to content

Instantly share code, notes, and snippets.

View QETHAN's full-sized avatar
🎯
Focusing

QETHAN QETHAN

🎯
Focusing
View GitHub Profile
const checkTime = (rule, value, callback) => {
if (!value) {
return callback(new Error('时间不能为空'));
}
setTimeout(() => {
console.log(value)
if (!Number.isInteger(value * 1)) {
callback(new Error('请输入整数值'));
} else {
callback()
const checkTime = (rule, value, callback) => {
if (!value) {
return callback(new Error('时间不能为空'));
}
setTimeout(() => {
if (!Number.isInteger(value)) {
callback(new Error('请输入数字值'));
} else {
callback()
}
submitForm (formName) {
this.$refs[formName].validate((valid) => {
if (valid) {
DetectorService.setSSHConfig(this.formData).then(
(res) => {
if (res.errcode === '0') {
this.$message({
message: 'SSH配置成功',
type: 'success',
duration: '1500'
<div class="content">
<div class="content-inner">
<el-form :model="formData" status-icon :rules="rules" ref="myForm" label-width="100px" class="demo-ruleForm">
<el-form-item label="IP" prop="server_ip">
<el-input v-model="formData.server_ip"></el-input>
</el-form-item>
<el-form-item label="用户名" prop="username">
<el-input v-model="formData.username"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password">
const checkIp = (rule, value, callback) => {
if (!value) {
return callback(new Error(`服务器IP不能为空`))
}
let regIp = /^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$/
let status = regIp.test(value)
if (!status) {
callback(new Error('IP格式错误'))
} else {
callback()
@QETHAN
QETHAN / iOS segue
Created November 9, 2014 17:17
swift storyboard segue
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var sc1: UISegmentedControl!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
@QETHAN
QETHAN / 关闭弹窗
Created October 24, 2014 05:21
js关闭弹窗
$(document).on('mouseup', function(e) {
if(!shareAddChanceTip.is(e.target) && shareAddChanceTip.has(e.target).length === 0){
shareAddChanceTip.hide();
}
if(!appAddChanceTip.is(e.target) && appAddChanceTip.has(e.target).length === 0){
appAddChanceTip.hide();
}
})

Table with fixed header on scroll

A simple table having its header fixed on scroll with JQuery.

A Pen by jgx on CodePen.

License.

@QETHAN
QETHAN / php 插入数据
Created August 31, 2014 08:48
php 插入数据
<?php
//连接数据库
mysql_connect('127.0.0.1', 'code1', '');
mysql_select_db('code1');
mysql_query("set names 'utf8'");
//预设数据以便进行更新操作
mysql_query("insert into user(name, age, class) values('王二', 19, '高三五班')");
$id = mysql_insert_id();
//在这里更新id为$id的行的名字为李白
@QETHAN
QETHAN / php MySQL连接
Created August 31, 2014 08:10
php MySQL连接
<?php
$link = mysql_connect('127.0.0.1', 'code1', '') or die('数据库连接失败');
mysql_select_db('code1');
mysql_query("set names 'utf8'");
$result = mysql_query('select * from user limit 1');
$row = mysql_fetch_array($result);
print_r($row);
PDO扩展