时间:2019-10-25
分类:
热度:
1610
swiper滑动失效的原因是因为swiper的初始化在数据加载之前完成了,解决这个问题有两种方法:
1. 使用vue提供的$nextTick()方法
在数据初始化完毕之后,再初始化swiper就可以了
this.$nextTick(function () {
var swiper = new Swiper('.swiper-container', {
loop: true, //循环切换
autoplay: true,//可选选项,自动滑动
// 如果需要分页器
...阅读全文>>
时间:2019-10-23
分类:
热度:
1693
1. 函数
1.1函数的3种定义方法
1.1.1 函数声明
//ES5
function getSum(){}
function (){}//匿名函数
//ES6
()=>{}//如果{}内容只有一行{}和return关键字可省, 复制代码
1.1.2 函数表达式(函数字面量)
//ES5
var sum=function(){}
//ES6
let sum=()=>{}//如果{}内容只有一行{}和return关键字可省, 复制代码
1.1.3 构造函数
var sum=new Ge...阅读全文>>
时间:2019-10-21
分类:
热度:
1686
Method
Path
Route Name
Controller.Action
GET
/posts
posts
app.controllers.posts.index
GET
/posts/new
new_post
app...阅读全文>>
时间:2019-10-18
分类:
热度:
2719
#route.js中添加一个路由规则
router.post('/upload',controller.upload.index);
在controller中新建upload文件
'use strict';
//node.js 文件操作对象
const fs = require('fs');
//node.js 路径操作对象
const path = require('path');
//egg.js Controller
const Controller = require('egg').Controller;
//故名思意 异步二进制 写入流
const aw...阅读全文>>
时间:2019-10-17
分类:
热度:
10735
链接:https://codepen.io/liniaa/pen/PooGoMM?&editable=true
这个产品设计实际有缺陷的,如果有a,ab那么只能选中a,解决方案是设置个定时器更新value,
如果继续输入则关闭定时器,不过还不如让用户选,产品设计有缺陷
<script src="//unpkg.com/vue/dist/vue.js"></script>
var Main = {
data() {
return {
optionsCopy: [{
value: '1',
...阅读全文>>
时间:2019-10-16
分类:
热度:
4064
原理:vue前端登录,提交账号密码给egg后端,后端比对信息后,使用jsonwebtoken对用户信息进行签名生成token,之后通过cookie返回给vue前端,前端需要使用token里的信息就使用js-base64进行token第二段解码即可。
vue前端路由跳转,进入路由前置守卫检测cookie中的token是否存在,不存在(已过期)则跳转登录,否则继续执行,然后在http拦截器里请求时存在token请求头带上token,后端未得到header则返回错误码,得到则用jsonwebtoken进行验证,是时间错误就从新发放token令牌,否则返回错误码,还要及时更新cookie时间,保证登...阅读全文>>
时间:2019-10-16
分类:
热度:
1706
/**
* 存储localStorage
*/
export const setStore = (name, content) => {
if (!name) return;
if (typeof content !== 'string') {
content = JSON.stringify(content);
}
window.localStorage.setItem(name, content);
}
/**
* 获取localStorage
*/
export const getStore = name => {
if ...阅读全文>>
Install
npm install html2canvas
Use
import html2canvas from 'html2canvas';
html
<!-- 截图区域 -->
<div id="faultTree" ref="faultTree" :style="{width: '100%', height: height + 'px'}"></div>
<!-- 显示图片区域 -->
<img style="width: 100%;height: 300px;" class="real_pic" :src="d...阅读全文>>
保存当前列表
pm2 save
设置pm2 开机启动
pm2 startup阅读全文>>
安装 Rclone
Linux或macOS有多种安装方式,这里选择脚本安装:
curl https://rclone.org/install.sh | sudo bash
install.sh
#!/usr/bin/env bash
# error codes
# 0 - exited without problems
# 1 - parameters not supported were used or some unexpected error occurred
# 2 - OS not supported by this script
# 3 - inst...阅读全文>>