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

@nodetech/vue-avatar

v1.0.3

Published

https://packages.myjiedian.com/vue-avatar

Downloads

10

Readme

图片上传与裁切

install

$ npm install @nodetech/vue-avatar
// or
$ yarn add @nodetech/vue-avatar

development

$ yarn
$ yarn dev

use

<style lang="less">
html, body {
  height: 100%;
  height: 100vh;
}
html {
  font-size: 14px;
}
body {
  background-color: #e0e0e0;
}
.window {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate3d(-50%, -50%, 0);
  background-color: #ffffff;
  border-radius: .2rem;
}
</style>

<template>
  <div class="window">
    <vue-avatar :image="demo.image"
                :preview="demo.preview"
                :showHandle="demo.showHandle"
                :uploadTips="demo.uploadTips"
                :previewCircle="demo.previewCircle"
                :previewSizes="demo.previewSizes"
                :cropperStyle="demo.cropperStyle"
                :cropperOptions="demo.cropperOptions"
                :onSave="onSave"
                :imgLoad="imgLoad" />
  </div>
</template>

<script>
import VueAvatar from '@nodetech/vue-avatar'
export default {
  components: {
    VueAvatar
  },
  data() {
    return {
      demo: {
        // 图片地址或 input选择的文件
        image: '',
        // 开启裁切预览
        preview: true,
        // 显示操作按钮 支持放大缩小 
        showHandle: true,
        // 上传提示语
        uploadTips: '点击上传文件,或将图片文件拖至此处',
        // 圆形预览图
        previewCircle: true,
        // 裁切区样式
        cropperStyle: {
          width: '320px',
          height: '320px'
        },
        // 裁切预览展示尺寸
        previewSizes: [128, 64, 32],
        // 输出文件类型
        outputType: 'png',
        // 裁切器参数
        cropperOptions: {
          size: 1, // 
          full: false, // 舒服三个月成功已原图比例的截图
          canMove: true, // 可移动图片
          canMoveBox: true, // 可移动裁切框
          fixedBox: true, // 固定截图框大小
          original: false, // 显示图片原始尺寸
          autoCrop: true, // 自动裁切
          autoCropWidth: 200, // 自动裁切大小
          autoCropHeight: 200, // 自动裁切大小
          centerBox: true, // 限制在图片内部
          high: false, // 截图信息展示是否是真实的输出宽高
          infoTrue: true, // 截图信息展示是否是真实的输出宽高
          enlarge: 1, // 是否按照截图框比例输出
          mode: 'contain' // 图片默认渲染方式 类似这些 ['contain', 'cover', '400px auto', 'auto 400px', '50%', 'auto 50%']
        }
      }
    }
  },
  methods: {
    // 保存按钮事件
    onSave(base64, blob) {
      console.log(base64, blob)
    },
    imgLoad(msg) {
      console.log(msg)
    }
  }
}
</script>