江辰

博客

前端如何支持PDF、Excel、Word在线预览

发布于 # 前端 # Excel # Word

注意一下几点: url 必须经过 encodeURIComponent 转移,且是能够打开的文件域名。 谷歌文件在线预览,必须使用代理,各种文件都支持。 不想用代理,可以用微软这个,但是微软这个,不支持最新的 xlsx 格式,xls 格式可以。 谷歌格式:https://docs.google.com/viewer?url=[url] 微软格式:https://view.officeapps.live.com/op/view.aspx?src=[url] 例子(Word) 谷歌: https://docs.google.com/viewer?url=http%3A%2F%2Fsruserfiletest.oss-cn-hangzhou.aliyuncs.com%2Fcrm%2Fcc604886ae8d4be9afffab02313d646d.docx%3FExpires%3D15458

图片和文件预览组件(部分源码),可拖动,缩小,放大

发布于 # React

源码 /* * 图片预览组件 * @Author: Jiang * @since: 2018-12-21 13:54:00 */ import React from 'react'; import { Modal, Icon } from 'antd'; import PropTypes from 'prop-types'; import config from 'Common/config'; import { redirect } from 'Common/util'; import './index.less'; // 判断游览器 const USER_AGENT = navigator.userAgent; export default class PreviewImage extends React.Component { constructor(props) {

精通JS (持续更新)

发布于 # JS

作用域 作用域是一套规则,用于确定在何处以及如何查找变量(标识符)。如果查找的目的是对 变量进行赋值,那么就会使用 LHS 查询;如果目的是获取变量的值,就会使用 RHS 查询。 LHS 查询var a = 2;,简单理解就是赋值 RHS 查询function foo(a) {}; foo(2); ,简单理解就是查询值 var a = 2; function foo() { console.log(a); } 全局作用域中创建了一个 a 变量。在 foo 函数中可以访问到这个变量 a。因为 console.log(a)在执行的时候,会在当前的作用域(foo)下进行查找,如果没有查找到该变量,会继续往上进行查找。直到没有找到为止。 function foo() { var a = 2; } console.log(a); 这时候输出 a,会提示 a is not defin

前端技术架构选型

发布于 # 前端技术架构

结语 可以从以下几个指标,来选择一套适合自己团队的项目。 是否符合团队的技术栈 是否符合项目需求 生态圈是否完善、社区是否活跃 开发效率是否会降低 团队的学习能力如何

GitHub 本地配置和全局配置

发布于 # React

原文地址:https://segmentfault.com/a/1190000002994742 还需要设置项目本地的配置和全局配置 $ git config --local user.name "" $ git config --local user.email "" $ git config --local user.password "" $ git config --global user.name "" $ git config --global user.email "" $ git config --global user.password ""