npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@danieldx/ncadmin-core

v1.4.13

Published

![vue 2.5](https://img.shields.io/badge/vue-2.5-green.svg) ![axios](https://img.shields.io/badge/axios-0.17-green.svg)

Downloads

148

Readme

ncadmin-core

vue 2.5 axios

ncadmin的核心组件库,包括配置开发的查询列表,编辑,详情页,弹窗等

install

npm install ncadmin-core

Usage

// 使用其工具库
import {
  ncformCommon,
  eventHub,
} from 'ncadmin-core';

// 使用其组件。具体的组件请阅读下面的组件文档
<nca-xxx></nca-xxx>

工具库

eventHub

事件总线,用于全局触发和监听事件

  import ncadminCore from 'ncadmin-core';
  const { eventHub } = ncadminCore;

  eventHub.$on(); // 监听事件
  eventHub.$emit(); // 触发事件 

ncformCommon

ncform的通用类库,请参考ncform-common项目的文档

组件列表

ncform

请参考ncform项目的文档

nca-detail

<template>
  <nca-detail></nca-detail>
</template>
<script>
  export default {
    data() {
      return {

      }
    }
  }
</script>

nca-detail-modal

<template>
  <nca-detail-modal></nca-detail-modal>
</template>
<script>
  export default {
    data() {
      return {
        
      }
    }
  }
</script>

nca-edit

<template>
  <nca-edit></nca-edit>
</template>
<script>
  export default {
    data() {
      return {
        
      }
    }
  }
</script>

nca-edit-modal

<template>
  <nca-edit-modal></nca-edit-modal>
</template>
<script>
  export default {
    data() {
      return {
        
      }
    }
  }
</script>

nca-list

<template>
  <nca-list></nca-list>
</template>
<script>
  export default {
    data() {
      return {
        
      }
    }
  }
</script>

nca-modal

弹窗组件,可配置弹窗的标题,底部按钮

弹窗里面的内容需要当一个组件来开发,组件需遵循nca-modal内容组件的规则来开发

<template>
  <nca-modal :visible.sync="visible" :modal-config="modalConfig">
    <!--
      当组件需要与弹窗进行交互时(比如通知弹窗关闭),请按下面的例子填写slot-scope和modal-id
    -->
    <component slot-scope="modalProps" :modal-id="modalProps.modalId"></component>
  </nca-modal>
</template>
<script>
  export default {
    data() {
      return {
        visible: false,
        modalConfig: {
          title: '', // 弹窗标题
          buttons: {
            confirm: { // 确定按钮
              enable: true,
              name: '',   // 按钮名称,默认确定
              showLoading: true, // 是否在异步请求时显示loading状态
            },
            cancel: { // 取消按钮
              enable: true,
              name: '',   // 取消
            },
            others: [
              {
                enable: true,
                name: '',   // 按钮名称
                eventName: '', // 按钮触发事件名称
                close: true, // 操作后是否关闭弹窗
                showLoading: false, // 是否在异步请求时显示loading状态,true的情况eventName必须提供
              }
            ]
          }
        }      
      }
    }
  }
</script>

弹窗内容组件开发规则和示例

<template>
</template>

<script>
  import ncadminCore from '@danieldx/ncadmin-core';
  const { eventHub, modalInsideMixins } = ncadminCore;
  
  export default {

    mixins: [modalInsideMixins],

    methods: {

      /**
       * 确认按钮事件处理
       * 请务必在执行确认操作后调用done方法。如果请求失败,把Error对象传给done
       * 如 成功:done()或done(data) 失败:done(e)
       */ 
      _confirmHandler(done) { },

      /**
       * 自定义的其它按钮的事件处理
       * 请务必在执行确认操作后调用done方法。如果请求失败,把Error对象传给done
       * 如 成功:done()或done(data) 失败:done(e)
       */ 
      _btnsEventHandler(config, done) { },
    }
  }
</script>

Widgets

nca-label

component: {
  name: 'nca-label',
  config: {
    color: ''
  },
  value: ''
}

nca-image

component: {
  name: 'nca-image',
  config: {
    maxWidth: ''
  },
  value: ''
}

组件使用方法

edit-page.vue

通过配置开发一个新建/编辑的页面 (根据配置中的idField字段,在$route中取页面唯一值(通常为Id)。值为0时,页面为新建状态,值为其他值时,页面为编辑状态。) 具体配置参考文档

示例

<template>
  <edit-page :config="config"></edit-page>
</template>

<script>
  import ncadminCore from 'ncadmin-core';
  const editPage = ncadminCore.edit;

  export default {
    component: {
      editPage
    },
    data: {
      return {
        config: {}
      }
    }
  }
</script>

list-page.vue

通过配置开发一个查询列表的页面

具体配置参考文档

示例

<template>
  <list-page :config="config" v-model="valueData"></list-page>
</template>

<script>
  import ncadminCore from 'ncadmin-core';
  const listPage = ncadminCore.list;

  export default {
    component: {
      listPage
    },
    data: {
      return {
          config: {},
          // value 传时默认值如下
          valueData: {
            pageNum: 1,
            pageSize: 20,
            query: {}
          }
      }
    }
  }
</script>