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

form-web

v1.0.0

Published

form-web

Downloads

2

Readme

form_web包开发注意事项:

本规范目标:代码风格统一,提升可维护性,可拓展,可控性;

代码风格

Vscode 相关配置

    1. 统一使用Vscode作为开发编辑器,基础配置如下
    //开启保存的时候自动格式化
    "editor.formatOnSave": true,
    // 编辑粘贴自动格式化
    "editor.formatOnPaste": true,
    // 每行回车时格式化
    "editor.formatOnType": true,
    "editor.lineHeight": 18,
    "editor.fontSize": 16,
    "editor.fontFamily": "Consolas, 'Courier New', monospace",
    "editor.detectIndentation": true,
    "window.title": "${dirty}${activeEditorMedium}${separator}${rootName}",
    "editor.renderWhitespace": "none",
    "editor.trimAutoWhitespace": true,
    "editor.lineNumbers": "on",
    "editor.wordWrap": "wordWrapColumn",
    "editor.wordWrapColumn": 145,
    "editor.autoClosingBrackets": "always",
    "html.format.preserveNewLines": false,
    1. 代码统一使用2个空格缩进,配置如下
    "editor.tabSize": 2,
    "editor.insertSpaces": true,
    1. 统一使用Vetur插件格式化vue代码,Vetur配置如下:(注意Vetur版本要新的)
    "vetur.completion.autoImport": false,
    "vetur.format.defaultFormatterOptions": {
      "prettier": {
          //属性行的长度 格式化代码 超过会自动换行
          "printWidth": 120
      }
    }
    1. 其他配置
    // 如果编辑器卡配置下面这个为false
    "search.followSymlinks": false,
    // 自动提示 视乎电脑配置高低,配置高的可以开启,配置低的会卡
    "editor.quickSuggestions": true,
    // 保存时如果速度较慢,则配置此项-格式化超时时间 单位秒
    "editor.formatOnSaveTimeout": 300,

JS书写规范

  1. 变量和方法名采用驼峰命名法
  2. 变量和方法名至少由两个单词组成
  3. 禁止对内置原生方法进行扩展,如Number.xxx = fn或Number.prototype.xxx = fn
  4. 切勿滥用全局对象,如确实需要创建全局对象需统一在入口文件内显式的挂载到window下

Vue单文件组件格式

  1. 为了保持统一的编码格式,vue单文件组件的写法按如下规则
<template>...</template>
                              <-注意,template和script之间空一行
<script>
  import XXX from 'xxxxx'
                              <-注意,import和export之间需要空一行
  export default {            <-注意,此处配置顺序按如下顺序,如某项没有则可不写
    name: '',                 
    components: {},
    props: {},
    data () {
      return {}
    },
    computed: {},
    beforeCreate (){},
    created (){},
    beforeMount (){},
    mounted (){},
    beforeUpdate (){},
    updated (){},
    beforeDestroy (){},
    destroyed (){},
    methods: {},
    watch: {},
  }
</script>
                            <-注意,script和style之间空一行
<style lang="less" scoped>  <-注意,style必须加scoped
  ...
</style>

如果有组件内的路由的钩子,则放在watch后面,依然按照beforeXX,XXed顺序放置。

  1. 单文件组件代码不能超过300行。
  2. 路由组件的 name 是必需的,和路由配置的name对应。
  3. template 模板内不能做复杂的计算
  4. 不能使用jQuery等直接操作Dom

其他规则

1、组件放置规则:

  • 1)业务无关的公共组件,放置于src\components
  • 2)业务关联性强的组件,放置于自身目录中的components

2、样式:公共样式应注意命名空间

  • 1)表单样式统一置于src\components\globalStyles -> singlePage-wrapper内
  • 2)组件样式需置于scoped下