quick-methods
Advanced tools
Comparing version 0.0.5 to 0.0.6
@@ -108,3 +108,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
console.log(_String__WEBPACK_IMPORTED_MODULE_0__["default"].insertAtCursor) | ||
/* harmony default export */ __webpack_exports__["default"] = ({ | ||
@@ -220,10 +219,50 @@ ..._String__WEBPACK_IMPORTED_MODULE_0__["default"], | ||
__webpack_require__.r(__webpack_exports__); | ||
// import numeration from './numeration' | ||
/* harmony import */ var _price__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); | ||
/* harmony default export */ __webpack_exports__["default"] = ({ | ||
// ...numeration | ||
..._price__WEBPACK_IMPORTED_MODULE_0__["default"] | ||
}); | ||
/***/ }), | ||
/* 5 */ | ||
/***/ (function(module, __webpack_exports__, __webpack_require__) { | ||
"use strict"; | ||
__webpack_require__.r(__webpack_exports__); | ||
// 加 ¥ | ||
function formatPrice(price, symbol = "¥ ") { | ||
return symbol + this.filterPrice(price) | ||
} | ||
// 分转成元 | ||
//小数位为0直接显示整数,有一位显示一位,有多位显示两位 | ||
function filterPrice(data) { | ||
if(typeof data === 'string'){ | ||
data = Number(data) | ||
} | ||
if (typeof data !== 'number' || isNaN(data) === true) { | ||
console.error('Please enter number type') | ||
return '0' | ||
} | ||
var yuan = Number(data / 100); | ||
var fixed0 = yuan.toFixed(0); | ||
var fixed1 = yuan.toFixed(1); | ||
var fixed2 = yuan.toFixed(2); | ||
if (Number(fixed0) == Number(fixed1) && Number(fixed1) == Number(fixed2)) { | ||
return fixed0; | ||
} else if (Number(fixed0) != Number(fixed1) && Number(fixed1) == Number(fixed2)) { | ||
return fixed1; | ||
} else { | ||
return fixed2; | ||
} | ||
} | ||
/* harmony default export */ __webpack_exports__["default"] = ({ | ||
formatPrice, | ||
filterPrice | ||
}); | ||
/***/ }) | ||
/******/ ])["default"]; | ||
}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["quick-methods"]=t():e["quick-methods"]=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var u=t[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,n),u.l=!0,u.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)n.d(r,u,function(t){return e[t]}.bind(null,u));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=n(1),u=n(4);t.default={...r.default,...u.default}},function(e,t,n){"use strict";n.r(t);var r=n(2),u=n(3);t.default={copy:r.default,insertAtCursor:u.default}},function(e,t,n){"use strict";n.r(t),t.default=function(e){if("string"!=typeof e)return!1;let t=null;return null===(t=document.getElementById("quick-input-select"))&&((t=document.createElement("input")).type="text",t.id="quick-input-select"),t.style.left="-1000px",t.style.position="absolute",document.body.appendChild(t),t.value=e,t.select(),!!document.execCommand&&document.execCommand("copy")}},function(e,t,n){"use strict";n.r(t),t.default=function(e,t,n){if(e.selectionStart||0===e.selectionStart){var r=e.selectionStart,u=e.selectionEnd,o=u-r;t=t.substring(0,r)+n+t.substring(u,t.length),setTimeout(()=>{e.focus();var t=u+n.length-o;e.setSelectionRange(t,t)})}else t+=n,e.focus();return t}},function(e,t,n){"use strict";n.r(t),t.default={}}]).default})); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["quick-methods"]=t():e["quick-methods"]=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var u=t[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,n),u.l=!0,u.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)n.d(r,u,function(t){return e[t]}.bind(null,u));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t);var r=n(1),u=n(4);t.default={...r.default,...u.default}},function(e,t,n){"use strict";n.r(t);var r=n(2),u=n(3);t.default={copy:r.default,insertAtCursor:u.default}},function(e,t,n){"use strict";n.r(t),t.default=function(e){if("string"!=typeof e)return!1;let t=null;return null===(t=document.getElementById("quick-input-select"))&&((t=document.createElement("input")).type="text",t.id="quick-input-select"),t.style.left="-1000px",t.style.position="absolute",document.body.appendChild(t),t.value=e,t.select(),!!document.execCommand&&document.execCommand("copy")}},function(e,t,n){"use strict";n.r(t),t.default=function(e,t,n){if(e.selectionStart||0===e.selectionStart){var r=e.selectionStart,u=e.selectionEnd,o=u-r;t=t.substring(0,r)+n+t.substring(u,t.length),setTimeout(()=>{e.focus();var t=u+n.length-o;e.setSelectionRange(t,t)})}else t+=n,e.focus();return t}},function(e,t,n){"use strict";n.r(t);var r=n(5);t.default={...r.default}},function(e,t,n){"use strict";n.r(t),t.default={formatPrice:function(e,t="¥ "){return t+this.filterPrice(e)},filterPrice:function(e){if("string"==typeof e&&(e=Number(e)),"number"!=typeof e||!0===isNaN(e))return"0";var t=Number(e/100),n=t.toFixed(0),r=t.toFixed(1),u=t.toFixed(2);return Number(n)==Number(r)&&Number(r)==Number(u)?n:Number(n)!=Number(r)&&Number(r)==Number(u)?r:u}}}]).default})); |
import Vue from 'vue' | ||
import VueRouter from 'vue-router' | ||
import App from './App.vue' | ||
import './main.css' | ||
@@ -5,0 +6,0 @@ import routes from './routes' |
const emptyComponent = { | ||
template: `<div><router-view></router-view></div>` | ||
} | ||
const routes = [ | ||
{ path: '/home', component: ()=>import('../view/home') }, | ||
{ path: '/tow', component: ()=>import('../view/tow') } | ||
{ | ||
path: '/', | ||
redirect: '/copy', | ||
component: emptyComponent, | ||
meta: { | ||
title: 'String', | ||
index: '1' | ||
}, | ||
children: [ | ||
{ path: '/copy', meta: { title: 'copy', index: '1-1' }, component: () => import('../view/string/copy') }, | ||
{ path: '/insertAtCursor', meta: { title: 'insertAtCursor', index: '1-2' }, component: () => import('../view/string/insertAtCursor') } | ||
] | ||
}, | ||
] | ||
export default routes |
import stringM from './String' | ||
import numberM from './Number' | ||
console.log(stringM.insertAtCursor) | ||
export default { | ||
@@ -6,0 +5,0 @@ ...stringM, |
@@ -1,5 +0,5 @@ | ||
// import numeration from './numeration' | ||
import price from './price' | ||
export default { | ||
// ...numeration | ||
...price | ||
} |
{ | ||
"name": "quick-methods", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "", | ||
@@ -26,2 +26,3 @@ "main": "index.js", | ||
"clean-webpack-plugin": "^3.0.0", | ||
"css-loader": "^3.2.0", | ||
"eslint": "^6.7.0", | ||
@@ -32,2 +33,3 @@ "eslint-loader": "^3.0.2", | ||
"regenerator-runtime": "^0.13.3", | ||
"style-loader": "^1.0.1", | ||
"terser-webpack-plugin": "^2.2.1", | ||
@@ -34,0 +36,0 @@ "vue": "^2.6.10", |
@@ -22,3 +22,7 @@ | ||
loader: 'vue-loader' | ||
} | ||
}, | ||
{ | ||
test: /\.css$/i, | ||
use: ['style-loader', 'css-loader'], | ||
}, | ||
] | ||
@@ -25,0 +29,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23949
27
21
508