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

@uivjs/admin-login

v1.1.2

Published

登录页面组件

Downloads

11

Readme

@uivjs/admin-login

登录界面

安装

npm i @uivjs/admin-login

使用

<template>
  <login title="请登录" @submit="submit" @reset="reset" />
</template>

<script>
import Login from '@uivjs/admin-login';

export default {
  components: {
    Login,
  },
  methods: {
    submit(e) {
      e.preventDefault()
      const data = new FormData(e.target);
      const value = Object.fromEntries(data.entries());
      console.group('submit')
      console.log(':==>', data)
      console.log(':==>', value)
      console.log(':==>', data.get('username'))
      console.log(':==>', data.get('password'))
      console.groupEnd()
    },
    reset(e) {
      console.dir(e.target)
      e.target.reset();
      const data = new FormData(e.target);
      const value = Object.fromEntries(data.entries());
      console.group('reset')
      console.log(':==>', data.get('username'))
      console.log(':==>', data.get('password'))
      console.log('>>>', value)
      console.dir(data)
      console.groupEnd()
    }
  },
}
</script>

自定义登录页面

如果你在组件 login 添加 children 内容,将替换默认表单内容。

<template>
  <login>
    <form class="uiv-login-form" @submit="submit" @reset="reset">
      <h2>请登录</h2>
      <div>
        <label>
          <input type="text" name="username" :value="username" placeholder="请输入账号" />
        </label>
      </div>
      <div>
        <label>
          <input type="password" name="password" :value="password" placeholder="请输入密码" />
        </label>
      </div>
      <div class="uiv-login-button">
        <button type="submit">登录</button>
        <button type="reset">重置</button>
      </div>
    </form>
  </login>
</template>

<script>
import Login from '@uivjs/admin-login';

export default {
  components: {
    Login,
  },
  data() {
    return {
      username: '',
      password: '',
    };
  },
  methods: {
    submit(e) {
      e.preventDefault()
      const data = new FormData(e.target);
      const value = Object.fromEntries(data.entries());
      console.group('submit')
      console.log(':==>', data)
      console.log(':==>', value)
      console.log(':==>', data.get('username'))
      console.log(':==>', data.get('password'))
      console.groupEnd()
    },
    reset(e) {
      console.dir(e.target)
      e.target.reset();
      const data = new FormData(e.target);
      const value = Object.fromEntries(data.entries());
      console.group('reset')
      console.log(':==>', data.get('username'))
      console.log(':==>', data.get('password'))
      console.log('>>>', value)
      console.dir(data)
      console.groupEnd()
    }
  },
}
</script>

Login Props

Name | Type | Default | Description ---- | ---- | ---- | ---- bgURL | string | - | 背景图片 logoURL | string | - | Logo 地址 title | string | 登录 | 表单标题 username | string | - | 用户名 password | string | - | 密码 onSubmit | (e: Event, data: Values) => void | - | 提交表单时触发 onReset | (e: Event) => void | - | 当收到一个 reset 事件时触发 onChange | (e: Event) => void | - | 取或设置当前元素的 change 事件的事件处理函数. onInput | (e: Event) => void | - | 表单输入触发 onBlur | (e: Event) => void | - | 输入框失去焦点触发 onFocus | (e: Event) => void | - | 输入框获取焦点触发

License

Licensed under the MIT License.