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

v-detail-value

v0.1.0

Published

A Vue 2 directive to display form values in a friendly way, including remote data support.

Downloads

71

Readme

封住了一个基于ant-design-vue的a-form相关的指令,想要通过简单设置一些属性,将表单设置为只读,同时友好显示a-select、a-radio、a-date-picker等组件的只读状态

安装介绍

  // 注册指令并传递前端字典和其他配置信息
  Vue.use(vDetailValue, {
    getServerDictApi,
    frontendDict
  });

  getServerDictApi,  // 获取远程字典的方法,如果字典表没有对应的数据,将会调用这个方法来获取
  frontendDict  // 前端字典表,可以配置在某个文件里面,我将会把它放在Map里面,例如:frontendDict.get('yesOrNo')

export default (optionName) => {
    return Promise.resolve(serverData[optionName])
}
使用示例(通过readOnly控制的)
  • 直接使用直接绑定到value属性上
    <a-input v-model="userForm.name" v-detail="{ readOnly, value: userForm.name }" />
  • select、radio等可以依靠options设置备选项的,都通过options和value对应来显示,这时候options就是必传的,这里的$localDict是我添加到Vue.prototype上面的,其实就是前端字典,这里只是为了方面使用
    <a-select
          v-model="userForm.isStudent"
          :options="$localDict.get('yesOrNo')"
          v-detail="{ readOnly, value: userForm.isStudent, isBorder: false, options: yesOrNoOptions }"
        >
  • select、radio 等的options可能来自数据库而不是本地字典,这时候使用optionName异步获取字典表,optionName也可以拿到本地字典
    <a-select
          v-model="userForm.reachPlace"
          :options="provinceOptions"
          mode="multiple"
          v-detail="{ readOnly, value: userForm.reachPlace, optionName: 'province', multiply: true }"
        >
        </a-select>