mj-double-name-self-increase
v1.0.1
Published
重名自增
Downloads
7
Readme
1、下载安装指令
npm install mj-double-name-self-increase --save
2、功能介绍
重名自增,比如做断点续传的时候,暂停了一个文件,然后又重新选择这个文件上传,此时就需要给一样名字的文件再去一个名字了。此插件是在同名文件后面自增(1)。
3、函数方法介绍
doubleNameSelfIncrease('string')
:需要传一个字符串,也就是文件名。
4、调用方式
CDN引入
<script src="./node_modules/mj-double-name-self-increase/index.js"></script>
<script>
let { doubleNameSelfIncrease } = doubleNameSelfIncreases;
console.log(doubleNameSelfIncrease('children'));
// children
console.log(doubleNameSelfIncrease('children'));
// children(1)
</script>
vue引入
import { doubleNameSelfIncrease } from "mj-double-name-self-increase";
// let { doubleNameSelfIncrease } = require("mj-double-name-self-increase");
export default {
data() {
return {};
},
mounted() {
console.log(doubleNameSelfIncrease('fileName'));
// fileName
console.log(doubleNameSelfIncrease('fileName'));
// fileName(1)
console.log(doubleNameSelfIncrease('jk'));
// jk
console.log(doubleNameSelfIncrease('jk'));
// jk(1)
console.log(doubleNameSelfIncrease('jk'));
// jk(2)
console.log(doubleNameSelfIncrease('fileName'));
// fileName(2)
},
};