1.0 v0.3.6
git 10 years ago
parent 7091fb7013
commit 58267e3c0b

108
dist/example.js vendored

@ -593,7 +593,7 @@
/***/ function(module, exports, __webpack_require__) { /***/ function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/*! /* WEBPACK VAR INJECTION */(function(global) {/*!
* Vue.js v1.0.24 * Vue.js v1.0.26
* (c) 2016 Evan You * (c) 2016 Evan You
* Released under the MIT License. * Released under the MIT License.
*/ */
@ -992,10 +992,15 @@
// UA sniffing for working around browser-specific quirks // UA sniffing for working around browser-specific quirks
var UA = inBrowser && window.navigator.userAgent.toLowerCase(); var UA = inBrowser && window.navigator.userAgent.toLowerCase();
var isIE = UA && UA.indexOf('trident') > 0;
var isIE9 = UA && UA.indexOf('msie 9.0') > 0; var isIE9 = UA && UA.indexOf('msie 9.0') > 0;
var isAndroid = UA && UA.indexOf('android') > 0; var isAndroid = UA && UA.indexOf('android') > 0;
var isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA); var isIos = UA && /(iphone|ipad|ipod|ios)/i.test(UA);
var isWechat = UA && UA.indexOf('micromessenger') > 0; var iosVersionMatch = isIos && UA.match(/os ([\d_]+)/);
var iosVersion = iosVersionMatch && iosVersionMatch[1].split('_');
// detecting iOS UIWebView by indexedDB
var hasMutationObserverBug = iosVersion && Number(iosVersion[0]) >= 9 && Number(iosVersion[1]) >= 3 && !window.indexedDB;
var transitionProp = undefined; var transitionProp = undefined;
var transitionEndEvent = undefined; var transitionEndEvent = undefined;
@ -1036,7 +1041,7 @@
} }
/* istanbul ignore if */ /* istanbul ignore if */
if (typeof MutationObserver !== 'undefined' && !(isWechat && isIos)) { if (typeof MutationObserver !== 'undefined' && !hasMutationObserverBug) {
var counter = 1; var counter = 1;
var observer = new MutationObserver(nextTickHandler); var observer = new MutationObserver(nextTickHandler);
var textNode = document.createTextNode(counter); var textNode = document.createTextNode(counter);
@ -1108,12 +1113,12 @@
p.put = function (key, value) { p.put = function (key, value) {
var removed; var removed;
if (this.size === this.limit) {
removed = this.shift();
}
var entry = this.get(key, true); var entry = this.get(key, true);
if (!entry) { if (!entry) {
if (this.size === this.limit) {
removed = this.shift();
}
entry = { entry = {
key: key key: key
}; };
@ -1358,7 +1363,7 @@
var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]); var unsafeOpen = escapeRegex(config.unsafeDelimiters[0]);
var unsafeClose = escapeRegex(config.unsafeDelimiters[1]); var unsafeClose = escapeRegex(config.unsafeDelimiters[1]);
tagRE = new RegExp(unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\n)+?)' + close, 'g'); tagRE = new RegExp(unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '|' + open + '((?:.|\\n)+?)' + close, 'g');
htmlRE = new RegExp('^' + unsafeOpen + '.*' + unsafeClose + '$'); htmlRE = new RegExp('^' + unsafeOpen + '((?:.|\\n)+?)' + unsafeClose + '$');
// reset cache // reset cache
cache = new Cache(1000); cache = new Cache(1000);
} }
@ -2145,7 +2150,8 @@
return (/HTMLUnknownElement/.test(el.toString()) && return (/HTMLUnknownElement/.test(el.toString()) &&
// Chrome returns unknown for several HTML5 elements. // Chrome returns unknown for several HTML5 elements.
// https://code.google.com/p/chromium/issues/detail?id=540526 // https://code.google.com/p/chromium/issues/detail?id=540526
!/^(data|time|rtc|rb)$/.test(tag) // Firefox returns unknown for some "Interactive elements."
!/^(data|time|rtc|rb|details|dialog|summary)$/.test(tag)
); );
} }
}; };
@ -2481,7 +2487,9 @@
} }
if (child.mixins) { if (child.mixins) {
for (var i = 0, l = child.mixins.length; i < l; i++) { for (var i = 0, l = child.mixins.length; i < l; i++) {
parent = mergeOptions(parent, child.mixins[i], vm); var mixin = child.mixins[i];
var mixinOptions = mixin.prototype instanceof Vue ? mixin.options : mixin;
parent = mergeOptions(parent, mixinOptions, vm);
} }
} }
for (key in parent) { for (key in parent) {
@ -2909,10 +2917,13 @@
hasProto: hasProto, hasProto: hasProto,
inBrowser: inBrowser, inBrowser: inBrowser,
devtools: devtools, devtools: devtools,
isIE: isIE,
isIE9: isIE9, isIE9: isIE9,
isAndroid: isAndroid, isAndroid: isAndroid,
isIos: isIos, isIos: isIos,
isWechat: isWechat, iosVersionMatch: iosVersionMatch,
iosVersion: iosVersion,
hasMutationObserverBug: hasMutationObserverBug,
get transitionProp () { return transitionProp; }, get transitionProp () { return transitionProp; },
get transitionEndEvent () { return transitionEndEvent; }, get transitionEndEvent () { return transitionEndEvent; },
get animationProp () { return animationProp; }, get animationProp () { return animationProp; },
@ -3400,7 +3411,9 @@
var restoreRE = /"(\d+)"/g; var restoreRE = /"(\d+)"/g;
var pathTestRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/; var pathTestRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['.*?'\]|\[".*?"\]|\[\d+\]|\[[A-Za-z_$][\w$]*\])*$/;
var identRE = /[^\w$\.](?:[A-Za-z_$][\w$]*)/g; var identRE = /[^\w$\.](?:[A-Za-z_$][\w$]*)/g;
var booleanLiteralRE = /^(?:true|false)$/; var literalValueRE$1 = /^(?:true|false|null|undefined|Infinity|NaN)$/;
function noop() {}
/** /**
* Save / Rewrite / Restore * Save / Rewrite / Restore
@ -3482,7 +3495,7 @@
// save strings and object literal keys // save strings and object literal keys
var body = exp.replace(saveRE, save).replace(wsRE, ''); var body = exp.replace(saveRE, save).replace(wsRE, '');
// rewrite all paths // rewrite all paths
// pad 1 space here becaue the regex matches 1 extra char // pad 1 space here because the regex matches 1 extra char
body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore); body = (' ' + body).replace(identRE, rewrite).replace(restoreRE, restore);
return makeGetterFn(body); return makeGetterFn(body);
} }
@ -3503,7 +3516,15 @@
return new Function('scope', 'return ' + body + ';'); return new Function('scope', 'return ' + body + ';');
/* eslint-enable no-new-func */ /* eslint-enable no-new-func */
} catch (e) { } catch (e) {
("production") !== 'production' && warn('Invalid expression. ' + 'Generated function body: ' + body); if (false) {
/* istanbul ignore if */
if (e.toString().match(/unsafe-eval|CSP/)) {
warn('It seems you are using the default build of Vue.js in an environment ' + 'with Content Security Policy that prohibits unsafe-eval. ' + 'Use the CSP-compliant build instead: ' + 'http://vuejs.org/guide/installation.html#CSP-compliant-build');
} else {
warn('Invalid expression. ' + 'Generated function body: ' + body);
}
}
return noop;
} }
} }
@ -3565,8 +3586,8 @@
function isSimplePath(exp) { function isSimplePath(exp) {
return pathTestRE.test(exp) && return pathTestRE.test(exp) &&
// don't treat true/false as paths // don't treat literal values as paths
!booleanLiteralRE.test(exp) && !literalValueRE$1.test(exp) &&
// Math constants e.g. Math.PI, Math.E etc. // Math constants e.g. Math.PI, Math.E etc.
exp.slice(0, 5) !== 'Math.'; exp.slice(0, 5) !== 'Math.';
} }
@ -3982,7 +4003,7 @@
} }
var isA = isArray(val); var isA = isArray(val);
var isO = isObject(val); var isO = isObject(val);
if (isA || isO) { if ((isA || isO) && Object.isExtensible(val)) {
if (val.__ob__) { if (val.__ob__) {
var depId = val.__ob__.dep.id; var depId = val.__ob__.dep.id;
if (seen.has(depId)) { if (seen.has(depId)) {
@ -4045,6 +4066,7 @@
var tagRE$1 = /<([\w:-]+)/; var tagRE$1 = /<([\w:-]+)/;
var entityRE = /&#?\w+?;/; var entityRE = /&#?\w+?;/;
var commentRE = /<!--/;
/** /**
* Convert a string template to a DocumentFragment. * Convert a string template to a DocumentFragment.
@ -4067,8 +4089,9 @@
var frag = document.createDocumentFragment(); var frag = document.createDocumentFragment();
var tagMatch = templateString.match(tagRE$1); var tagMatch = templateString.match(tagRE$1);
var entityMatch = entityRE.test(templateString); var entityMatch = entityRE.test(templateString);
var commentMatch = commentRE.test(templateString);
if (!tagMatch && !entityMatch) { if (!tagMatch && !entityMatch && !commentMatch) {
// text only, return a single text node. // text only, return a single text node.
frag.appendChild(document.createTextNode(templateString)); frag.appendChild(document.createTextNode(templateString));
} else { } else {
@ -5035,7 +5058,7 @@
* the filters. This is passed to and called by the watcher. * the filters. This is passed to and called by the watcher.
* *
* It is necessary for this to be called during the * It is necessary for this to be called during the
* wathcer's dependency collection phase because we want * watcher's dependency collection phase because we want
* the v-for to update when the source Object is mutated. * the v-for to update when the source Object is mutated.
*/ */
@ -5378,7 +5401,10 @@
}, },
update: function update(value) { update: function update(value) {
this.el.value = _toString(value); // #3029 only update when the value changes. This prevent
// browsers from overwriting values like selectionStart
value = _toString(value);
if (value !== this.el.value) this.el.value = value;
}, },
unbind: function unbind() { unbind: function unbind() {
@ -5427,6 +5453,8 @@
var select = { var select = {
bind: function bind() { bind: function bind() {
var _this = this;
var self = this; var self = this;
var el = this.el; var el = this.el;
@ -5458,7 +5486,12 @@
// selectedIndex with value -1 to 0 when the element // selectedIndex with value -1 to 0 when the element
// is appended to a new parent, therefore we have to // is appended to a new parent, therefore we have to
// force a DOM update whenever that happens... // force a DOM update whenever that happens...
this.vm.$on('hook:attached', this.forceUpdate); this.vm.$on('hook:attached', function () {
nextTick(_this.forceUpdate);
});
if (!inDoc(el)) {
nextTick(this.forceUpdate);
}
}, },
update: function update(value) { update: function update(value) {
@ -6728,7 +6761,7 @@
if (value === undefined) { if (value === undefined) {
value = getPropDefaultValue(vm, prop); value = getPropDefaultValue(vm, prop);
} }
value = coerceProp(prop, value); value = coerceProp(prop, value, vm);
var coerced = value !== rawValue; var coerced = value !== rawValue;
if (!assertProp(prop, value, vm)) { if (!assertProp(prop, value, vm)) {
value = undefined; value = undefined;
@ -6847,13 +6880,17 @@
* @return {*} * @return {*}
*/ */
function coerceProp(prop, value) { function coerceProp(prop, value, vm) {
var coerce = prop.options.coerce; var coerce = prop.options.coerce;
if (!coerce) { if (!coerce) {
return value; return value;
} }
// coerce is a function if (typeof coerce === 'function') {
return coerce(value); return coerce(value);
} else {
("production") !== 'production' && warn('Invalid coerce for prop "' + prop.name + '": expected function, got ' + typeof coerce + '.', vm);
return value;
}
} }
/** /**
@ -7385,10 +7422,9 @@
// resolve on owner vm // resolve on owner vm
var hooks = resolveAsset(this.vm.$options, 'transitions', id); var hooks = resolveAsset(this.vm.$options, 'transitions', id);
id = id || 'v'; id = id || 'v';
oldId = oldId || 'v';
el.__v_trans = new Transition(el, id, hooks, this.vm); el.__v_trans = new Transition(el, id, hooks, this.vm);
if (oldId) {
removeClass(el, oldId + '-transition'); removeClass(el, oldId + '-transition');
}
addClass(el, id + '-transition'); addClass(el, id + '-transition');
} }
}; };
@ -7813,7 +7849,7 @@
if (token.html) { if (token.html) {
replace(node, parseTemplate(value, true)); replace(node, parseTemplate(value, true));
} else { } else {
node.data = value; node.data = _toString(value);
} }
} else { } else {
vm._bindDir(token.descriptor, node, host, scope); vm._bindDir(token.descriptor, node, host, scope);
@ -8797,7 +8833,7 @@
}; };
} }
function noop() {} function noop$1() {}
/** /**
* A directive links a DOM element with a piece of data, * A directive links a DOM element with a piece of data,
@ -8896,7 +8932,7 @@
} }
}; };
} else { } else {
this._update = noop; this._update = noop$1;
} }
var preProcess = this._preProcess ? bind(this._preProcess, this) : null; var preProcess = this._preProcess ? bind(this._preProcess, this) : null;
var postProcess = this._postProcess ? bind(this._postProcess, this) : null; var postProcess = this._postProcess ? bind(this._postProcess, this) : null;
@ -10334,7 +10370,7 @@
json: { json: {
read: function read(value, indent) { read: function read(value, indent) {
return typeof value === 'string' ? value : JSON.stringify(value, null, Number(indent) || 2); return typeof value === 'string' ? value : JSON.stringify(value, null, arguments.length > 1 ? indent : 2);
}, },
write: function write(value) { write: function write(value) {
try { try {
@ -10407,7 +10443,13 @@
pluralize: function pluralize(value) { pluralize: function pluralize(value) {
var args = toArray(arguments, 1); var args = toArray(arguments, 1);
return args.length > 1 ? args[value % 10 - 1] || args[args.length - 1] : args[0] + (value === 1 ? '' : 's'); var length = args.length;
if (length > 1) {
var index = value % 10 - 1;
return index in args ? args[index] : args[length - 1];
} else {
return args[0] + (value === 1 ? '' : 's');
}
}, },
/** /**
@ -10592,7 +10634,9 @@
} }
} }
if (type === 'component' && isPlainObject(definition)) { if (type === 'component' && isPlainObject(definition)) {
if (!definition.name) {
definition.name = id; definition.name = id;
}
definition = Vue.extend(definition); definition = Vue.extend(definition);
} }
this.options[type + 's'][id] = definition; this.options[type + 's'][id] = definition;
@ -10607,7 +10651,7 @@
installGlobalAPI(Vue); installGlobalAPI(Vue);
Vue.version = '1.0.24'; Vue.version = '1.0.26';
// devtools global hook // devtools global hook
/* istanbul ignore next */ /* istanbul ignore next */
@ -11001,7 +11045,7 @@
if (this.extensions && (this.extensions.length || typeof this.extensions.length == 'undefined')) { if (this.extensions && (this.extensions.length || typeof this.extensions.length == 'undefined')) {
var extensions = this.extensions; var extensions = this.extensions;
if ((typeof extensions === 'undefined' ? 'undefined' : (0, _typeof3.default)(extensions)) == 'object' && RegExp instanceof extensions) {} else { if ((typeof extensions === 'undefined' ? 'undefined' : (0, _typeof3.default)(extensions)) == 'object' && extensions instanceof RegExp) {} else {
if (typeof extensions == 'string') { if (typeof extensions == 'string') {
extensions = extensions.split(',').map(function (value) { extensions = extensions.split(',').map(function (value) {
return value.trim(); return value.trim();

File diff suppressed because one or more lines are too long

@ -887,7 +887,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.extensions && (this.extensions.length || typeof this.extensions.length == 'undefined')) { if (this.extensions && (this.extensions.length || typeof this.extensions.length == 'undefined')) {
var extensions = this.extensions; var extensions = this.extensions;
if ((typeof extensions === 'undefined' ? 'undefined' : (0, _typeof3.default)(extensions)) == 'object' && RegExp instanceof extensions) {} else { if ((typeof extensions === 'undefined' ? 'undefined' : (0, _typeof3.default)(extensions)) == 'object' && extensions instanceof RegExp) {} else {
if (typeof extensions == 'string') { if (typeof extensions == 'string') {
extensions = extensions.split(',').map(function (value) { extensions = extensions.split(',').map(function (value) {
return value.trim(); return value.trim();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,14 +1,12 @@
{ {
"name": "vue-upload-component", "name": "vue-upload-component",
"description": "Vue.js file upload component, Support for multiple file uploads, progress, html5, html4, support ie9", "description": "Vue.js file upload component, Support for multiple file uploads, progress, html5, html4, support ie9",
"version": "0.3.5", "version": "0.3.6",
"author": "LianYue", "author": "LianYue",
"scripts": { "scripts": {
"dev": "webpack-dev-server --inline --hot", "dev": "webpack-dev-server --inline --hot",
"build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.build.min.js && cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.build.js && cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.js" "build": "cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.build.min.js && cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.build.js && cross-env NODE_ENV=production webpack --progress --hide-modules --config webpack.config.js"
}, },
"main": "dist/vue-upload-component.js", "main": "dist/vue-upload-component.js",
"repository": { "repository": {
"type": "git", "type": "git",
@ -33,20 +31,20 @@
}, },
"homepage": "https://github.com/lian-yue/vue-upload-component#readme", "homepage": "https://github.com/lian-yue/vue-upload-component#readme",
"dependencies": { "dependencies": {
"vue": "^1.0.24"
}, },
"devDependencies": { "devDependencies": {
"babel-runtime": "^6.0.0",
"babel-core": "^6.0.0", "babel-core": "^6.0.0",
"babel-loader": "^6.0.0", "babel-loader": "^6.0.0",
"babel-plugin-transform-runtime": "^6.0.0", "babel-plugin-transform-runtime": "^6.0.0",
"babel-preset-es2015": "^6.0.0", "babel-preset-es2015": "^6.0.0",
"babel-preset-stage-2": "^6.0.0", "babel-preset-stage-2": "^6.0.0",
"babel-runtime": "^6.0.0",
"cross-env": "^1.0.6", "cross-env": "^1.0.6",
"css-loader": "^0.23.0", "css-loader": "^0.23.0",
"file-loader": "^0.8.4", "file-loader": "^0.8.4",
"json-loader": "^0.5.4", "json-loader": "^0.5.4",
"url-loader": "^0.5.7", "url-loader": "^0.5.7",
"vue": "^1.0.26",
"vue-hot-reload-api": "^1.2.0", "vue-hot-reload-api": "^1.2.0",
"vue-html-loader": "^1.0.0", "vue-html-loader": "^1.0.0",
"vue-loader": "^8.2.1", "vue-loader": "^8.2.1",

@ -6,19 +6,19 @@
</template> </template>
<style> <style>
.file-uploads { .file-uploads {
overflow: hidden; overflow: hidden;
position: relative; position: relative;
text-align: center; text-align: center;
} }
.file-uploads span{ .file-uploads span{
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
-o-user-select: none; -o-user-select: none;
user-select: none; user-select: none;
} }
.file-uploads input{ .file-uploads input{
z-index: 1; z-index: 1;
opacity: 0; opacity: 0;
font-size: 20em; font-size: 20em;
@ -29,8 +29,8 @@
position: absolute; position: absolute;
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
.file-uploads.file-uploads-html5 input{ .file-uploads.file-uploads-html5 input{
float: left; float: left;
width: 1px !important; width: 1px !important;
height: 1px !important; height: 1px !important;
@ -38,11 +38,10 @@
left:-1px !important; left:-1px !important;
right:auto !important; right:auto !important;
bottom:auto !important; bottom:auto !important;
} }
</style> </style>
<script> <script>
export default { export default {
props: { props: {
title: { title: {
@ -134,7 +133,7 @@ export default {
this.files = []; this.files = [];
}, },
watch: { watch: {
drop(value) { drop(value) {
this._drop(value); this._drop(value);
}, },
@ -328,7 +327,7 @@ export default {
if (this.extensions && (this.extensions.length || typeof this.extensions.length == 'undefined')) { if (this.extensions && (this.extensions.length || typeof this.extensions.length == 'undefined')) {
var extensions = this.extensions; var extensions = this.extensions;
if (typeof extensions == 'object' && RegExp instanceof extensions) { if (typeof extensions == 'object' && extensions instanceof RegExp) {
} else { } else {
if (typeof extensions == 'string') { if (typeof extensions == 'string') {
@ -658,7 +657,6 @@ export default {
iframe.parentNode && iframe.parentNode.removeChild(iframe); iframe.parentNode && iframe.parentNode.removeChild(iframe);
if (!file.removed) { if (!file.removed) {
_self._events('afterFileUpload', file); _self._events('afterFileUpload', file);
} }
setTimeout(function() { setTimeout(function() {
_self._fileUploads(); _self._fileUploads();
@ -688,7 +686,6 @@ export default {
}, 50); }, 50);
_self._events('beforeFileUpload', file); _self._events('beforeFileUpload', file);
}, 10); }, 10);
}, },
} }
} }

Loading…
Cancel
Save