Narcissistic, Perfectly Modest

    lcj

    1.0.11 • Public • Published

    NPM

    NPM包管理

    本地开发

    $ npm run dev

    打包dist

    $ npm run build

    NPM发布

    $ npm run pub

    操作指南:

    module.exports和exports和export和export default的区别,import和require的区别:

    https://www.jianshu.com/p/f6c5a646c00b

    export default,exports.default,module.exports,require,import整理:

    https://www.jianshu.com/p/8fde36da1537

    babel-plugin-add-module-exports使用:

    https://www.npmjs.com/package/babel-plugin-add-module-exports

    .babelrc文件中必须添加:
    {
      "plugins": [
        [
          "add-module-exports",
          {
            "addDefaultProperty": true
          }
        ]
      ]
    }
    才可以使用:export default 或 exports.default;
    

    getScroll组件使用:

      import { getScroll } from 'lcj';
      const {getScrollHeight, getScrollTop, getWindowHeight} = getScroll;
      
      componentWillMount () {
          window.addEventListener('scroll', () => {
              let scrollTopDistance = getScrollTop();
              let scrollBottomDistance = getScrollHeight() - getScrollTop() - getWindowHeight();
              console.log('获取页面滚动条距离顶部的距离:', scrollTopDistance);
              console.log('获取页面滚动条距离底部的距离:', scrollBottomDistance);
              }
          )
      }

    参考文档:https://www.cnblogs.com/winyh/p/6715010.html

    Keywords

    Install

    npm i lcj

    DownloadsWeekly Downloads

    12

    Version

    1.0.11

    License

    ISC

    Unpacked Size

    53.9 kB

    Total Files

    22

    Last publish

    Collaborators

    • liuchaojie