- 博客(11)
- 资源 (1)
- 收藏
- 关注
原创 vue 打包组件的时候如何不让样式分离
使用 vue-cli-service build --no-clean --target lib --name ComponentName.vue构建组件的时候发现组件的样式分离出去了,解决方法如下: 在 vue.config.js 中设置 css: { extract: false }。
2021-05-25 11:48:31
1228
原创 vscode通过点击运行npm脚本
首先打开设置界面,再搜索栏中输入npm.enableRunFromFolder,勾选。 然后打开侧栏菜单,右击勾选npm 脚本
2021-05-24 16:37:10
1903
1
原创 git whatchanged
使用git whatchanged可以查看某段时间内的变化、举例: git whatchanged --since="5 hours ago" 会打印出过去5个小时内的变化,你也可以使用weeks, months, years作为时间关键词。
2021-05-17 15:46:30
559
原创 如何将项目里的vue组件单独打包?
首先打开package.json,再scripts属性下添加以下命令: "scripts": { ... "lib:build": "vue-cli-service build --target lib --name VuePartivleground ./src/components/VuePartivleground/index.js", "lib:publish": "npm run lib:build && npm publish" }, VuePartiv
2020-12-21 09:58:49
2882
原创 如何将react-app 部署到 gh-pages
1、首先进入react 应用目录,安装GitHub Pages包。 cd my-app npm install gh-pages --save-dev 2、修改package.json文件夹 首先,我们要在添加homepage属性,它的结构是http://{username}.github.io/{repo-name}, {username}是你的github账户名,{repo-name}是你仓库的名字。 接着,在scripts属性下面添加predeploy和deploy命令 "scripts": {
2020-12-09 09:48:28
297
原创 React 组件定义props 默认值
可以在类里面定义一个defaultProps属性来设置默认值 class ReactComp extends React.Component {} ReactComp.defaultProps = {} // or class ReactComp extends React.Component { static defaultProps = {} } 如下面例子: // ES6 class class CatComponent extends React.Component { const
2020-12-02 09:05:48
1226
原创 react点击外部关闭事件
import React from "react"; import ReactDOM from "react-dom"; import "./styles.css"; class App extends React.Component { constructor() { super(); this.myRef = createRef(); this.state = { showModal: false }; } handleClick = ()
2020-12-01 09:45:40
1277
原创 react 第三方包报错“ Support for the experimental syntax ‘jsx‘ isn‘t currently enabled ”
这个原因是因为babel没有包含node_modules目录,导致里面的包无发解析造成的。 我这边的项目使用的是 react-app-rewired运行服务的, config-overrides.js配置如下: const path = require('path') const { override, babelInclude} = require('customize-cra') module.exports = override( babelInclude([ path.resolve(
2020-11-17 06:38:23
16869
原创 原生js如何判DOM节点是否隐藏
根据MDN文档的说明, 以下三种情况 HTMLElement.offsetParent会返回 null 该节点或其父节点display属性为 none 该节点的 position 属性设为 fiexed 该节点为<body>或 <html> 所以可以根据 HTMLElement.offsetParent 来判断改节点是否隐藏: function isHidden(el) { return (el.offsetParent === null) } 如果你要判断的节点恰
2020-11-13 16:16:25
1687
原创 javascript如何将时间字符串处理成 Date() 对象
一般我将一段时间字符串如2002-12-11 12:00:00 转成 Date对象,直接用下面这段代码就行了: new Date('2002-12-11 12:00:00') 可是MDN上写了这么一段说明: 注意: 由于浏览器之间的差异与不一致性,强烈不推荐使用Date构造函数来解析日期字符串 (或使用与其等价的Date.parse)。对 RFC 2822 格式的日期仅有约定俗称的支持。 对 ISO 8601 格式的支持中,仅有日期的串 (例如 “1970-01-01”) 会被处理为 UTC 而不是本地
2020-11-13 13:14:59
1554
原创 CKEdit如何限制上传图片大小
CKeditor 发送上传图片请求前会触发fileUploadRequest事件,通过监听该事件可以获取文件信息,从而判断图片大小。 this.editor.on('fileUploadRequest', evt => { const fileLoader = evt.data.fileLoader; const requestData = evt.data.requestData // 获取上传文件对象 const file = requestData.upload.
2020-10-30 14:45:53
1160
《快乐之道》游戏设计的黄金法则
2017-03-19
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅