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

@yu-ui/gd-upload

v1.1.18

Published

山东国盾网信息科技有限公司业务上传组件

Downloads

20

Readme

@yu-ui/gd-upload

该组建内部对接了文件中心的接口,用于文件的上传,下载以及展示。 如果是png,jpg,gif等图片格式会提供预览功能,如果是pdf,word,ppt等以及自定义格式则提供下载功能,会展示内置的icon

快速上手

@yu-ui/gd-upload组件内部使用了ant-design-vue,所以要求项目中要安装ant-design-vue,如果没有安装那么npm或者pnpm会自动在node_modules里面安装ant-design-vue依赖,可能后续会导致包依赖重复的问题,请知晓!!!

一、安装依赖

pnpm i @yu-ui/gd-upload

二、使用依赖

<script setup lang="ts">
// 引入上传组件包
import GdUpload from "@yu-ui/gd-upload";
// 引入axios实例
import http from "./utils/http/request.ts";
import { ref } from "vue";
const fileList = ref([]);
</script>

<template>
  <GdUpload
    :http="http"
    :file-list="fileList"
    business="seal"
    proxy-prefix="/api"
  />
</template>

属性介绍

{
  /**
   * 业务类型,如: seal
   */
  business: string;
  /**
   * proxy 代理的关键字 如: '/api'
   * 这个主要是用来做图片的回显操作,获取回显地址接口返回的是一个相对路径
   * 也就是说跟着项目服务走的,所以这边要跟着使用项目的代理去走,到时候做好判断
   * 如果是build的时候,把这个代理去掉,使用import.meta.env.PROD判断当前环境
   */
  proxyPrefix?: string;
  /**
   * 接受上传的文件类型, 详见 input accept Attribute
   * 如果不做限制,不需要使用该属性 ['.png']
   */
  accept?: string[];
  /**
   * 是否禁用
   */
  disabled?: boolean;
  /**
   * 限制上传数量。当为 1 时,始终用最新上传的文件代替当前文件
   */
  maxCount?: number;
  /**
   * 允许文件最大值
   */
  maxSize?: number;
  /**
   * 已经上传的文件列表(受控)
   */
  fileList: { id: string }[];
  /**
   * 接受一个`axios`实例,插件会根据传入的实例进行`get,post,delete`等请求,axios实例传入的目的是为了使用项目本身的`axios拦截器`
   */
  http: AxiosInstance;
  /**
   * img 的宽
   */
  itemWidth?: number;
  /**
   * img 的高
   */
  itemHeight?: number;
}

方法

  • updateFileList(list: FileListType[]) 手动更新回显
uploadRef.value.updateFileList(fileList.value);