wecui
Version:
一款基于Vue2.x版本的移动端web组件
2,444 lines (2,132 loc) • 247 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory(require("vue"));
else if(typeof define === 'function' && define.amd)
define(["vue"], factory);
else if(typeof exports === 'object')
exports["wecui"] = factory(require("vue"));
else
root["wecui"] = factory(root["Vue"]);
})(typeof self !== 'undefined' ? self : this, function(__WEBPACK_EXTERNAL_MODULE_3__) {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 45);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports) {
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file.
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
module.exports = function normalizeComponent (
rawScriptExports,
compiledTemplate,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier /* server only */
) {
var esModule
var scriptExports = rawScriptExports = rawScriptExports || {}
// ES6 modules interop
var type = typeof rawScriptExports.default
if (type === 'object' || type === 'function') {
esModule = rawScriptExports
scriptExports = rawScriptExports.default
}
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (compiledTemplate) {
options.render = compiledTemplate.render
options.staticRenderFns = compiledTemplate.staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = injectStyles
}
if (hook) {
var functional = options.functional
var existing = functional
? options.render
: options.beforeCreate
if (!functional) {
// inject component registration as beforeCreate hook
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
} else {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functioal component in vue file
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return existing(h, context)
}
}
}
return {
esModule: esModule,
exports: scriptExports,
options: options
}
}
/***/ }),
/* 1 */
/***/ (function(module, exports) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
// css base code, injected by the css-loader
module.exports = function(useSourceMap) {
var list = [];
// return the list of modules as css string
list.toString = function toString() {
return this.map(function (item) {
var content = cssWithMappingToString(item, useSourceMap);
if(item[2]) {
return "@media " + item[2] + "{" + content + "}";
} else {
return content;
}
}).join("");
};
// import a list of modules into the list
list.i = function(modules, mediaQuery) {
if(typeof modules === "string")
modules = [[null, modules, ""]];
var alreadyImportedModules = {};
for(var i = 0; i < this.length; i++) {
var id = this[i][0];
if(typeof id === "number")
alreadyImportedModules[id] = true;
}
for(i = 0; i < modules.length; i++) {
var item = modules[i];
// skip already imported module
// this implementation is not 100% perfect for weird media query combinations
// when a module is imported multiple times with different media queries.
// I hope this will never occur (Hey this way we have smaller bundles)
if(typeof item[0] !== "number" || !alreadyImportedModules[item[0]]) {
if(mediaQuery && !item[2]) {
item[2] = mediaQuery;
} else if(mediaQuery) {
item[2] = "(" + item[2] + ") and (" + mediaQuery + ")";
}
list.push(item);
}
}
};
return list;
};
function cssWithMappingToString(item, useSourceMap) {
var content = item[1] || '';
var cssMapping = item[3];
if (!cssMapping) {
return content;
}
if (useSourceMap && typeof btoa === 'function') {
var sourceMapping = toComment(cssMapping);
var sourceURLs = cssMapping.sources.map(function (source) {
return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */'
});
return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
}
return [content].join('\n');
}
// Adapted from convert-source-map (MIT)
function toComment(sourceMap) {
// eslint-disable-next-line no-undef
var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
return '/*# ' + data + ' */';
}
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
Modified by Evan You @yyx990803
*/
var hasDocument = typeof document !== 'undefined'
if (typeof DEBUG !== 'undefined' && DEBUG) {
if (!hasDocument) {
throw new Error(
'vue-style-loader cannot be used in a non-browser environment. ' +
"Use { target: 'node' } in your Webpack config to indicate a server-rendering environment."
) }
}
var listToStyles = __webpack_require__(82)
/*
type StyleObject = {
id: number;
parts: Array<StyleObjectPart>
}
type StyleObjectPart = {
css: string;
media: string;
sourceMap: ?string
}
*/
var stylesInDom = {/*
[id: number]: {
id: number,
refs: number,
parts: Array<(obj?: StyleObjectPart) => void>
}
*/}
var head = hasDocument && (document.head || document.getElementsByTagName('head')[0])
var singletonElement = null
var singletonCounter = 0
var isProduction = false
var noop = function () {}
var options = null
var ssrIdKey = 'data-vue-ssr-id'
// Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
// tags it will allow on a page
var isOldIE = typeof navigator !== 'undefined' && /msie [6-9]\b/.test(navigator.userAgent.toLowerCase())
module.exports = function (parentId, list, _isProduction, _options) {
isProduction = _isProduction
options = _options || {}
var styles = listToStyles(parentId, list)
addStylesToDom(styles)
return function update (newList) {
var mayRemove = []
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
domStyle.refs--
mayRemove.push(domStyle)
}
if (newList) {
styles = listToStyles(parentId, newList)
addStylesToDom(styles)
} else {
styles = []
}
for (var i = 0; i < mayRemove.length; i++) {
var domStyle = mayRemove[i]
if (domStyle.refs === 0) {
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j]()
}
delete stylesInDom[domStyle.id]
}
}
}
}
function addStylesToDom (styles /* Array<StyleObject> */) {
for (var i = 0; i < styles.length; i++) {
var item = styles[i]
var domStyle = stylesInDom[item.id]
if (domStyle) {
domStyle.refs++
for (var j = 0; j < domStyle.parts.length; j++) {
domStyle.parts[j](item.parts[j])
}
for (; j < item.parts.length; j++) {
domStyle.parts.push(addStyle(item.parts[j]))
}
if (domStyle.parts.length > item.parts.length) {
domStyle.parts.length = item.parts.length
}
} else {
var parts = []
for (var j = 0; j < item.parts.length; j++) {
parts.push(addStyle(item.parts[j]))
}
stylesInDom[item.id] = { id: item.id, refs: 1, parts: parts }
}
}
}
function createStyleElement () {
var styleElement = document.createElement('style')
styleElement.type = 'text/css'
head.appendChild(styleElement)
return styleElement
}
function addStyle (obj /* StyleObjectPart */) {
var update, remove
var styleElement = document.querySelector('style[' + ssrIdKey + '~="' + obj.id + '"]')
if (styleElement) {
if (isProduction) {
// has SSR styles and in production mode.
// simply do nothing.
return noop
} else {
// has SSR styles but in dev mode.
// for some reason Chrome can't handle source map in server-rendered
// style tags - source maps in <style> only works if the style tag is
// created and inserted dynamically. So we remove the server rendered
// styles and inject new ones.
styleElement.parentNode.removeChild(styleElement)
}
}
if (isOldIE) {
// use singleton mode for IE9.
var styleIndex = singletonCounter++
styleElement = singletonElement || (singletonElement = createStyleElement())
update = applyToSingletonTag.bind(null, styleElement, styleIndex, false)
remove = applyToSingletonTag.bind(null, styleElement, styleIndex, true)
} else {
// use multi-style-tag mode in all other cases
styleElement = createStyleElement()
update = applyToTag.bind(null, styleElement)
remove = function () {
styleElement.parentNode.removeChild(styleElement)
}
}
update(obj)
return function updateStyle (newObj /* StyleObjectPart */) {
if (newObj) {
if (newObj.css === obj.css &&
newObj.media === obj.media &&
newObj.sourceMap === obj.sourceMap) {
return
}
update(obj = newObj)
} else {
remove()
}
}
}
var replaceText = (function () {
var textStore = []
return function (index, replacement) {
textStore[index] = replacement
return textStore.filter(Boolean).join('\n')
}
})()
function applyToSingletonTag (styleElement, index, remove, obj) {
var css = remove ? '' : obj.css
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = replaceText(index, css)
} else {
var cssNode = document.createTextNode(css)
var childNodes = styleElement.childNodes
if (childNodes[index]) styleElement.removeChild(childNodes[index])
if (childNodes.length) {
styleElement.insertBefore(cssNode, childNodes[index])
} else {
styleElement.appendChild(cssNode)
}
}
}
function applyToTag (styleElement, obj) {
var css = obj.css
var media = obj.media
var sourceMap = obj.sourceMap
if (media) {
styleElement.setAttribute('media', media)
}
if (options.ssrId) {
styleElement.setAttribute(ssrIdKey, obj.id)
}
if (sourceMap) {
// https://developer.chrome.com/devtools/docs/javascript-debugging
// this makes source maps inside style tags work properly in Chrome
css += '\n/*# sourceURL=' + sourceMap.sources[0] + ' */'
// http://stackoverflow.com/a/26603875
css += '\n/*# sourceMappingURL=data:application/json;base64,' + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + ' */'
}
if (styleElement.styleSheet) {
styleElement.styleSheet.cssText = css
} else {
while (styleElement.firstChild) {
styleElement.removeChild(styleElement.firstChild)
}
styleElement.appendChild(document.createTextNode(css))
}
}
/***/ }),
/* 3 */
/***/ (function(module, exports) {
module.exports = __WEBPACK_EXTERNAL_MODULE_3__;
/***/ }),
/* 4 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_common_vue__ = __webpack_require__(31);
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_common_vue___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_common_vue__);
/* harmony namespace reexport (unknown) */ for(var __WEBPACK_IMPORT_KEY__ in __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_common_vue__) if(__WEBPACK_IMPORT_KEY__ !== 'default') (function(key) { __webpack_require__.d(__webpack_exports__, key, function() { return __WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_common_vue__[key]; }) }(__WEBPACK_IMPORT_KEY__));
var disposed = false
var normalizeComponent = __webpack_require__(0)
/* script */
/* template */
var __vue_template__ = null
/* template functional */
var __vue_template_functional__ = false
/* styles */
var __vue_styles__ = null
/* scopeId */
var __vue_scopeId__ = null
/* moduleIdentifier (server only) */
var __vue_module_identifier__ = null
var Component = normalizeComponent(
__WEBPACK_IMPORTED_MODULE_0__babel_loader_node_modules_vue_loader_lib_selector_type_script_index_0_common_vue___default.a,
__vue_template__,
__vue_template_functional__,
__vue_styles__,
__vue_scopeId__,
__vue_module_identifier__
)
Component.options.__file = "packages/spinner/src/spinner/common.vue"
/* hot reload */
if (false) {(function () {
var hotAPI = require("vue-hot-reload-api")
hotAPI.install(require("vue"), false)
if (!hotAPI.compatible) return
module.hot.accept()
if (!module.hot.data) {
hotAPI.createRecord("data-v-249ab826", Component.options)
} else {
hotAPI.reload("data-v-249ab826", Component.options)
}
module.hot.dispose(function (data) {
disposed = true
})
})()}
/* harmony default export */ __webpack_exports__["default"] = (Component.exports);
/***/ }),
/* 5 */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/* 6 */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/* 7 */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(8)(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/* 8 */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/* 9 */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.5.3' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/* 10 */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(11);
var defined = __webpack_require__(12);
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/* 11 */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(64);
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ }),
/* 12 */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/* 13 */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/* 14 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-button",
props: {
color: {
type: String,
required: false
},
disabled: {
// 是否禁用
type: Boolean,
default: false
},
plain: {
// 是否显示为平滑按钮
type: Boolean,
default: false
},
// 尺寸
size: {
type: String,
default: "medium",
validator: function validator(value) {
// 值必须是这些字符串中的一个
return ["small", "medium", "large", "mini", "block"].indexOf(value) !== -1;
}
},
// 类型
type: {
type: String,
default: "primary",
validator: function validator(value) {
return ["primary", "warning", "info", "success", "error", "text"].indexOf(value) !== -1;
}
}
},
data: function data() {
return {};
},
created: function created() {
// console.log(this.plain)
},
computed: {},
methods: {
handleClick: function handleClick(evt) {
this.$emit("click", evt);
}
}
};
/***/ }),
/* 15 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: 'wecHeader',
props: {
title: String,
showMore: {
type: Boolean,
default: false
},
showBack: {
type: Boolean,
default: false
},
backClick: {
type: Function
}
},
methods: {
backHandler: function backHandler() {
if (this.showBack && this.backClick && typeof this.backClick == 'function') {
this.backClick();
} else {
this.$router.go(-1);
}
// this.$emit('back-click',{})
},
moreClick: function moreClick() {
this.$emit('more-click', {});
}
}
};
/***/ }),
/* 16 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-tabbar",
props: {
value: {
type: String,
required: true
}
},
data: function data() {
return {};
},
watch: {
value: function value(val, oldVal) {
console.log('wec-tabbar...');
console.log(this.value);
}
},
methods: {},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 17 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-tab-item",
props: {
id: {
type: String,
required: true
}
},
data: function data() {
return {};
},
methods: {},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 18 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-tab-container",
props: {
value: {
type: String,
required: true
}
},
data: function data() {
return {
hasFooter: false,
hasHeader: false
};
},
methods: {},
computed: {
getClass: function getClass() {},
getStyle: {
cache: false,
get: function get() {
var _this = this;
this.$nextTick(function () {
var header = document.querySelector(".wec-header");
var tabbar = document.querySelector(".wec-tabbar");
var navbar = document.querySelector(".wec-navbar");
var oldClassName = _this.$refs.wectabcontainer.className;
var className = "";
if (header && oldClassName.indexOf("has-header") == -1) {
className += " has-header ";
}
if (tabbar && oldClassName.indexOf("has-footer") == -1) {
className += " has-footer ";
}
if (navbar) {
className += " has-navbar";
}
_this.$refs.wectabcontainer.className += className;
});
}
}
},
mounted: function mounted() {}
};
/***/ }),
/* 19 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-tab-container-item",
props: {
id: {
type: String,
required: true
}
},
data: function data() {
return {};
},
methods: {},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 20 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-navbar",
props: {
value: {
type: String,
required: true
}
},
data: function data() {
return {};
},
methods: {},
computed: {
getStyle: {
cache: false,
get: function get() {
var _this = this;
this.$nextTick(function () {
var header = document.querySelector(".wec-header");
var oldClassName = _this.$refs.wecnavbar.className;
var className = "";
if (header && oldClassName.indexOf("has-header") == -1) {
className += " has-header ";
}
_this.$refs.wecnavbar.className += className;
});
}
}
},
mounted: function mounted() {}
};
/***/ }),
/* 21 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-cell",
props: {
label: {
type: String,
required: true
},
value: {
type: String,
required: false
},
comment: {
type: String,
required: false
},
icon: {
type: String,
required: false
},
link: {
type: Boolean,
default: false,
required: false
},
to: {
type: [String, Object],
required: false
}
},
data: function data() {
return {};
},
methods: {
clickHandler: function clickHandler($event) {
this.$emit("click");
if (!this.link) {
$event.preventDefault();
return;
} else {
if (this.to) {
var resolved = this.$router.match(this.to);
if (!resolved.matched.length) {
location.href = this.to;
return;
}
this.$router.push(resolved.fullPath || resolved.path);
} else {
this.$emit("click");
}
}
}
},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 22 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-search",
props: {
autoSearch: {
type: Boolean,
default: false
}
},
data: function data() {
return {
showCancel: false,
showSearch: false,
queryValue: ""
};
},
watch: {
queryValue: function queryValue(val, oldValue) {
// 根据是否有值判断取消按钮是否显示
if (val) {
this.showCancel = true;
} else {
this.showCancel = false;
}
// 是否执行自动搜索
if (this.autoSearch) {
if (val !== oldValue) {
this.searchHandler();
}
}
}
},
methods: {
// 取消按钮点击事件
cancleHandler: function cancleHandler() {
this.queryValue = "";
},
searchHandler: function searchHandler() {
console.log("search...");
this.$emit("search", this.queryValue);
}
},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 23 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
exports.default = {
name: "wec-switch",
props: {
value: {
type: Boolean,
default: false
},
disabled: {
type: Boolean,
default: false
}
},
data: function data() {
return {
// checkValue: false
};
},
methods: {
checkHandler: function checkHandler() {
if (!this.disabled) {
this.checkValue = !this.checkValue;
}
}
},
watch: {},
computed: {
checkValue: {
get: function get() {
return this.value;
},
set: function set(value) {
this.$emit("input", value);
}
}
},
mounted: function mounted() {}
};
/***/ }),
/* 24 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-radio",
props: {
title: {
type: String,
required: true
},
options: {
type: [Array, Object],
required: true
},
value: {
type: [String, Object]
},
align: {
type: String,
default: "left",
required: false,
validator: function validator(value) {
return ["left", "right"].includes(value);
}
}
},
data: function data() {
return {
currentValue: this.value
};
},
watch: {
value: function value(val) {
this.currentValue = val;
},
currentValue: function currentValue(val) {
// console.log(val);
this.$emit("input", val);
}
},
methods: {
clickHandler: function clickHandler(option) {
// console.log(option);
if (option.disabled) {
return;
}
this.currentValue = option.value;
}
},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 25 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-checklist",
props: {
title: {
type: String,
required: true
},
options: {
type: [Array, Object],
required: true
},
value: {
type: Array
},
align: {
type: String,
default: "left",
required: false,
validator: function validator(value) {
return ["left", "right"].includes(value);
}
},
max: {
type: Number
}
},
data: function data() {
return {
currentValue: this.value
};
},
computed: {
limit: function limit() {
return this.max < this.currentValue.length;
}
},
watch: {
value: function value(val) {
this.currentValue = val;
},
currentValue: function currentValue(val) {
if (this.limit) val.pop();
this.$emit("input", val);
}
},
methods: {
clickHandler: function clickHandler(option) {
// console.log(option);
if (option.disabled) {
return;
}
// 如果已存在该数,删除,否则添加进入数组中
if (this.currentValue.includes(option)) {
var index = this.currentValue.indexOf(option);
this.currentValue.splice(index, 1);
} else {
this.currentValue.push(option);
}
}
},
mounted: function mounted() {}
};
/***/ }),
/* 26 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-field",
props: {
label: {
type: String,
required: true
},
rows: {
type: Number,
default: 4
},
placeholder: {
type: String
},
type: {
type: String,
default: "text"
},
state: {
type: String,
validator: function validator(value) {
return ["success", "error", "warning", "loading"].indexOf(value) !== -1;
}
},
value: {}
},
data: function data() {
return {
currentValue: "",
currentState: this.state
};
},
methods: {
blurHandler: function blurHandler() {
this.currentState = this.state;
this.$emit("input", this.currentValue);
},
focusHandler: function focusHandler() {
this.currentState = "loading";
}
},
computed: {
placeholderValue: {
get: function get() {
return this.placeholder || "请输入" + this.label;
},
set: function set(value) {}
}
},
mounted: function mounted() {},
watch: {
value: function value(val) {
this.currentValue = val;
}
// currentValue(val) {
// this.$emit("input", val);
// }
}
};
/***/ }),
/* 27 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
exports.default = {
props: {
message: {
type: String
},
visiable: {
type: Boolean,
default: false
},
iconClass: {
type: String
},
iconColor: {
type: String
},
position: {
type: String,
default: "middle",
validator: function validator(value) {
return ["top", "middle", "bottom"].indexOf(value) !== -1;
}
}
},
data: function data() {
return {};
},
methods: {},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 28 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-indicator",
props: {
text: {
type: String
},
iconClass: {
type: String
},
spinnerClass: {
type: String,
default: "snake"
},
visiable: {
type: Boolean,
default: false
}
},
data: function data() {
return {};
},
methods: {},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 29 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-spinner",
props: {
type: {
type: String,
default: "snake",
validator: function validator(value) {
return ["snake", "double", "triple", "fading"].indexOf(value) !== -1;
}
},
color: {
type: String
},
size: {
type: Number
}
},
data: function data() {
return {};
},
methods: {},
computed: {
componentText: {
get: function get() {
return "wec-" + this.type;
},
set: function set(value) {}
}
},
mounted: function mounted() {},
components: {
WecSnake: __webpack_require__(127).default,
WecDouble: __webpack_require__(131).default,
WecTriple: __webpack_require__(135).default,
WecFading: __webpack_require__(139).default
}
};
/***/ }),
/* 30 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _common = __webpack_require__(4);
var _common2 = _interopRequireDefault(_common);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: "wec-snake",
mixins: [_common2.default]
}; //
//
//
//
//
//
//
//
//
//
/***/ }),
/* 31 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = {
computed: {
spinnerColor: function spinnerColor() {
return this.color || this.$parent.color || '#09f';
},
spinnerSize: function spinnerSize() {
return (this.size || this.$parent.size || 28) + 'px';
}
},
props: {
size: Number,
color: String
}
};
/***/ }),
/* 32 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _common = __webpack_require__(4);
var _common2 = _interopRequireDefault(_common);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: "wec-double",
mixins: [_common2.default]
}; //
//
//
//
//
//
/***/ }),
/* 33 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _common = __webpack_require__(4);
var _common2 = _interopRequireDefault(_common);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: "wec-triple",
mixins: [_common2.default]
}; //
//
//
//
//
//
//
/***/ }),
/* 34 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _common = __webpack_require__(4);
var _common2 = _interopRequireDefault(_common);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = {
name: "wec-fading",
created: function created() {
if (this.$isServer) {
return;
}
this.styleNode = document.createElement("style");
var css = ".wec-fading > span::before { background-color: " + this.spinnerColor + "; }";
this.styleNode.type = "text/css";
this.styleNode.rel = "stylesheet";
this.styleNode.title = "fading circle style";
document.getElementsByTagName("head")[0].appendChild(this.styleNode);
this.styleNode.appendChild(document.createTextNode(css));
},
destroyed: function destroyed() {
if (this.styleNode) {
this.styleNode.parentNode.removeChild(this.styleNode);
}
},
mixins: [_common2.default]
}; //
//
//
//
//
/***/ }),
/* 35 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-message-box",
props: {
title: {
type: String
},
okText: {
type: String
},
message: {
type: String
},
visiable: {
type: Boolean
}
},
data: function data() {
return {
callback: null,
cancelText: "",
type: "",
inputType: "",
inputValue: "",
editorErrorMessage: ""
};
},
methods: {
actionHandler: function actionHandler(action) {
var callback = this.callback;
this.visiable = false;
this.type === "prompt" ? callback(action, this.inputValue) : callback(action);
this.inputValue = "";
}
},
computed: {},
mounted: function mounted() {},
watch: {
visiable: function visiable(val) {
var _this = this;
if (val) {
if (this.type == "prompt") {
setTimeout(function () {
if (_this.$refs.input) {
_this.$refs.input.focus();
}
}, 500);
}
}
}
}
};
/***/ }),
/* 36 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-actionsheet",
props: {
actions: {
type: Array,
required: true
},
cancelText: {
type: String,
default: "取消"
},
onModalClose: {
type: Boolean,
default: true
},
value: {}
},
data: function data() {
return {};
},
methods: {
modalClickHandler: function modalClickHandler() {
if (this.onModalClose) {
this.currentValue = false;
}
},
itemClickHandler: function itemClickHandler(action, index) {
if (typeof action == "function") {
action(index);
}
this.currentValue = false;
}
},
computed: {
currentValue: {
get: function get() {
return this.value;
},
set: function set(value) {
this.$emit("input", value);
}
}
},
mounted: function mounted() {}
};
/***/ }),
/* 37 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: "wec-popup",
props: {
value: {},
modal: {
type: Boolean,
default: true
}
},
data: function data() {
return {};
},
methods: {},
computed: {
currentValue: {
get: function get() {
return this.value;
},
set: function set(value) {
this.$emit("input", value);
}
}
},
mounted: function mounted() {}
};
/***/ }),
/* 38 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _dom = __webpack_require__(156);
exports.default = {
name: "wec-swipe",
props: {
initIndex: {
type: Number,
default: 0
},
duration: {
type: Number,
default: 2000
},
speed: {
type: Number,
default: 300
},
indicators: {
type: Boolean,
default: true
}
},
data: function data() {
return {
childLength: 0,
currentIndex: this.initIndex,
timer: null,
pages: [],
moveObj: {},
draging: false
};
},
watch: {
currentIndex: function currentIndex(value) {
this.$emit("change", value);
}
},
methods: {
translate: function translate(element, offset, speed, callback) {
var _this2 = this,
_arguments = arguments;
if (speed) {
// this.animating = true;
element.style.webkitTransition = "-webkit-transform " + speed + "ms ease-in-out";
setTimeout(function () {
element.style.webkitTransform = "translate3d(" + offset + "px, 0, 0)";
}, 50);
var called = false;
var transitionEndCallback = function transitionEndCallback() {
if (called) return;
called = true;
// this.animating = false;
element.style.webkitTransition = "";
element.style.webkitTransform = "";
if (callback) {
callback.apply(_this2, _arguments);
}
};
(0, _dom.once)(element, "webkitTransitionEnd", transitionEndCallback);
setTimeout(transitionEndCallback, speed + 100);
} else {
element.style.webkitTransition = "";
element.style.webkitTransform = "translate3d(" + offset + "px, 0, 0)";
}
},
changePage: function changePage(direction) {
var _this3 = this;
var currentIndex = this.currentIndex;
var preIndex = void 0,
nextIndex = void 0,
prePage = void 0,
nextPage = void 0,
currentPage = void 0,
pageWidth = void 0,
speedX = void 0;
var speed = this.speed || 300;
var pages = this.pages;
// 获取页面的宽度
pageWidth = this.$el.clientWidth;
// 上一页
prePage = pages[currentIndex - 1];
// 当前页
currentPage = pages[currentIndex];
// 下一页
nextPage = pages[currentIndex + 1];
// 如果上一页不存在,则index=0, 上一页为最后一页
if (!prePage) {
prePage = pages[pages.length - 1];
}
// 如果没有下一页,则index = pages.length; 下一页为第一页
if (!nextPage) {
nextPage = pages[0];
}
if (direction == "left") {
// 如果没有下一页,则index = pages.length; 下一页为第一页
if (currentIndex <= 0) {
nextIndex = pages.length - 1;
} else {
nextIndex = currentIndex - 1;
}
} else if (direction == "right") {
// 如果上一页不存在,则index=0, 上一页为最后一页
if (currentIndex >= pages.length - 1) {
nextIndex = 0;
} else {
nextIndex = currentIndex + 1;
}
}
// 把前一张移动到左侧
if (prePage) {
prePage.style.display = "block";
this.translate(prePage, -pageWidth);
}
// 把后一张移动到右侧
if (nextPage) {
nextPage.style.display = "block";
this.translate(nextPage, pageWidth);
}
var newIndex = nextIndex;
// 回调方法
var callback = function callback() {
if (newIndex !== undefined) {
var newPage = _this3.$children[newIndex].$el;
(0, _dom.removeClass)(currentPage, "is-active");
(0, _dom.addClass)(newPage, "is-active");
_this3.currentIndex = newIndex;
}
if (prePage) {
prePage.style.display = "";
}
if (nextPage) {
nextPage.style.display = "";
}
};
// 开始执行动画
setTimeout(function () {
if (direction === "right") {
_this3.translate(currentPage, -pageWidth, speed, callback);
if (nextPage) {
_this3.translate(nextPage, 0, speed);
}
} else if (direction === "left") {
_this3.translate(currentPage, pageWidth, speed, callback);
if (prePage) {
_this3.translate(prePage, 0, speed);
}
}
}, 10);
},
// 添加触摸监听事件
addTouchEventListener: function addTouchEventListener(element) {
var _this = this;
var moveObj = this.moveObj;
// 监听鼠标事件
element.addEventListener("touchstart", function (event) {
var touch = event.touches[0];
_this.draging = true;
// event.preventDefault();
moveObj.startX = touch.pageX;
moveObj.startY = touch.pageY;
moveObj.startTime = new Date();
});
//触摸过程中的事件
element.addEventListener("touchmove", function (event) {
if (!_this.draging) {
return;
}
if (_this.timer) {
_this.clearTimer();
}
var touch = event.touches[0];
moveObj.endX = touch.pageX;
moveObj.endY = touch.pageY;
});
// 磋磨结束事件
element.addEventListener("touchend", function (event) {
moveObj.endTime = new Date();
_this.draging = false;
// 重新初始化定时器
_this.initTimer();
moveObj.moveX = moveObj.endX - moveObj.startX;
moveObj.moveY = moveObj.endY - moveObj.startY;
// 横向滚动距离大于垂直方向的滚动距离
if (Math.abs(moveObj.moveX) > Math.abs(moveObj.moveY)) {
if (moveObj.moveX < 0) {
_this.changePage("right");
} else {
_this.changePage("left");
}
}
});
},
clearTimer: function clearTimer() {
clearInterval(this.timer);
this.timer = null;
},
reInitPages: function reInitPages() {
var _this = this;
var children = this.$children;
children.forEach(function (child, index) {
_this.pages.push(child.$el);
(0, _dom.removeClass)(child.$el, "is-active");
if (index === _this.currentIndex) {
(0, _dom.addClass)(child.$el, "is-active");
}
});
},
initTimer: function initTimer() {
var _this4 = this;
var _this = this;
this.$nextTick(function () {
_this4.childLength = _this4.pages.length;
// 设置定时器
if (!_this4.timer && _this4.duration > 0 && _this4.childLength > 1) {
_this.timer = setInterval(function () {
if (!_this.draging) {
_this.changePage("right"); //默认向右移动
}
}, _this4.duration);
}
});
}
},
computed: {},
mounted: function mounted() {
this.reInitPages();
this.initTimer();
// 监听鼠标的移动事件
this.addTouchEventListener(this.$el);
},
created: function created() {}
}; //
//
//
//
//
//
//
//
//
//
//
//
/***/ }),
/* 39 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
exports.default = {
name: 'wec-swipe-item',
props: {},
data: function data() {
return {};
},
methods: {},
computed: {},
mounted: function mounted() {}
};
/***/ }),
/* 40 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
exports.default = {
name: "wec-range",
props: {
label: {
type: String,
default: ""
},
step: {
type: Number,
default: 10
},
sliderType: {
type: [String, Number],
default: "circle"
},
min: {
type: Number,
default: 0
},
max: {
type: Number,
default: 100
},
showLable: {
type: Boolean,
default: true
},
disabled: {
type: Boolean,
default: false
},
value: {}
},
data: function data() {
return {
slider: null,
dragState: {
startX: 0,
endX: 0,
sliderStartX: 0
}
};
},
methods: {
setSlider: function setSlider(value) {
var _this = this;
this.slider = this.$refs.slider;
var parent = _this.$refs.content.getBoundingClientRect();
var sliderObj = _this.slider.getBoundingClientRect();
var sliderHalfWidth = sliderObj.width / 2;
var progress = Math.floor((value - _this.min) / (_this.max - _this.min) * 100);
_this.slider.style.left = progress / 100 * parent.width - sliderHalfWidth + "px";
}
},
computed: {
// 滑块样式,暂时只提供圆形一种
sliderClass: function sliderClass() {
if (this.sliderType == "circle") {}
return "wrapper-slider--cicle";
},
// 计算刻度尺的数量
scaleCount: function scaleCount() {
return Math.ceil((this.max - this.min) / this.step);
},
currentValue: {
get: function get() {
return this.value;
},
set: function set(value) {
this.$emit("input", value);
}
}
},
mounted: function mounted() {
var _this2 = this;
var _this = this;
// 设置默认刻度值
this.setSlider(this.currentValue);
this.$nextTick(function () {
_this2.slider = _this2.$refs.slider;
var getSliderPosition = function getSliderPosition() {
var parent = _this2.$refs.content.getBoundingClientRect();
var sliderObj = _this2.slider.getBoundingClientRect();
return {
left: sliderObj.left - parent.left
};
};
// 开始移动
_this2.slider.addEventListener("touchstart", function (event) {
if (_this.disabled) {
return;
}
var parent = _this.$refs.content.getBoundingClientRect();
var sliderObj = _this.slider.getBoundingClientRect();
var touch = event.touches[0];
// let position = getSliderPosition();
// 定义鼠标开始移动时的起点
_this.dragState.startX = touch.pageX;
// 获取滑块开始移动式的left值
_this.dragState.sliderStar