diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..6adb5130621a0d4134c060b890e17d1997d386b1 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,37 @@ +{ + "editor.formatOnSave": true, + "editor.renderControlCharacters": true, + "editor.renderWhitespace": "all", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true, + "source.fixAll.stylelint": true + }, + "px2rem-plus.base": 50, + "[html]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[css]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[less]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[javascript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[typescript]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[vue]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[json]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[jsonc]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + }, + "[markdown]": { + "editor.defaultFormatter": "esbenp.prettier-vscode" + } +} diff --git a/JYeontuComponentWarehouse/.editorconfig b/JYeontuComponentWarehouse/.editorconfig new file mode 100644 index 0000000000000000000000000000000000000000..f651b7eca3b6156aed08b73155e426b78a4863a1 --- /dev/null +++ b/JYeontuComponentWarehouse/.editorconfig @@ -0,0 +1,15 @@ +# https://editorconfig.org + +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +insert_final_newline = false +trim_trailing_whitespace = false \ No newline at end of file diff --git a/JYeontuComponentWarehouse/babel.config.js b/JYeontuComponentWarehouse/babel.config.js index ba179669a123909a9728283fd9c004c65adb90c5..e6f2ce4c7bfb09ff85584783bfbee8394bfcceaf 100644 --- a/JYeontuComponentWarehouse/babel.config.js +++ b/JYeontuComponentWarehouse/babel.config.js @@ -1,5 +1,3 @@ module.exports = { - presets: [ - '@vue/app' - ] -} + presets: ["@vue/app"] +}; diff --git a/JYeontuComponentWarehouse/examples/App.vue b/JYeontuComponentWarehouse/examples/App.vue index 11e4248851efe6a458928e116f821eb906246395..ccbb8abb96ef26ef3f37654acdcb6ca761db23a6 100644 --- a/JYeontuComponentWarehouse/examples/App.vue +++ b/JYeontuComponentWarehouse/examples/App.vue @@ -1,144 +1,149 @@ diff --git a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.css b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.css index e20d3898d5a7788a5ef08764981ea1a35695ee67..1f5f338facbcb4faec4432c245db4bd5328e936a 100644 --- a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.css +++ b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.css @@ -1,84 +1,102 @@ @font-face { - font-family: "iconfont"; /* Project id 2846995 */ - src: url('iconfont.woff2?t=1637570793422') format('woff2'), - url('iconfont.woff?t=1637570793422') format('woff'), - url('iconfont.ttf?t=1637570793422') format('truetype'); + font-family: "iconfont"; /* Project id 2846995 */ + src: url("iconfont.woff2?t=1639480707807") format("woff2"), + url("iconfont.woff?t=1639480707807") format("woff"), + url("iconfont.ttf?t=1639480707807") format("truetype"); } .iconfont { - font-family: "iconfont" !important; - font-size: 16px; - font-style: normal; - -webkit-font-smoothing: antialiased; - -moz-osx-font-smoothing: grayscale; - color: deepskyblue; + font-family: "iconfont" !important; + font-size: 16px; + font-style: normal; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; +} + +.icon-banbenxinxi:before { + content: "\e71d"; +} + +.icon-star:before { + content: "\e681"; +} + +.icon-danchuang:before { + content: "\e63c"; +} + +.icon-xuanfuanniufadongtai:before { + content: "\e6e8"; +} + +.icon-shuzidizeng:before { + content: "\e652"; } .icon-anzhuangbao:before { - content: "\e6ef"; + content: "\e6ef"; } .icon-zifuchuanchulimoban:before { - content: "\e661"; + content: "\e661"; } .icon-huaban1:before { - content: "\e61f"; + content: "\e61f"; } .icon-youxiyouxiji:before { - content: "\e61e"; + content: "\e61e"; } .icon-shuzishurukuang:before { - content: "\e69c"; + content: "\e69c"; } .icon-gongju1:before { - content: "\e607"; + content: "\e607"; } .icon-shijian1:before { - content: "\e612"; + content: "\e612"; } .icon-daima:before { - content: "\e703"; + content: "\e703"; } .icon-icon__liuchengtu:before { - content: "\e618"; + content: "\e618"; } .icon-huaban:before { - content: "\e6e2"; + content: "\e6e2"; } .icon-shijian:before { - content: "\e6a0"; + content: "\e6a0"; } .icon-gongju:before { - content: "\e73f"; + content: "\e73f"; } .icon-gangqin:before { - content: "\e66c"; + content: "\e66c"; } .icon-biaoge:before { - content: "\e721"; + content: "\e721"; } .icon-calendar:before { - content: "\e8cf"; + content: "\e8cf"; } .icon-number:before { - content: "\e660"; + content: "\e660"; } .icon-home:before { - content: "\e689"; + content: "\e689"; } - diff --git a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.json b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.json index 8e376bdb02c0245ca72d37ca679a4ffaff7b2eb6..4f43f6ede529ab615158fbc97887032fd82f02f1 100644 --- a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.json +++ b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.json @@ -1,128 +1,163 @@ { - "id": "2846995", - "name": "JYeontuComponents", - "font_family": "iconfont", - "css_prefix_text": "icon-", - "description": "", - "glyphs": [ - { - "icon_id": "2679664", - "name": "安装包", - "font_class": "anzhuangbao", - "unicode": "e6ef", - "unicode_decimal": 59119 - }, - { - "icon_id": "4579372", - "name": "字符串处理模板", - "font_class": "zifuchuanchulimoban", - "unicode": "e661", - "unicode_decimal": 58977 - }, - { - "icon_id": "8832745", - "name": "龙卷风", - "font_class": "huaban1", - "unicode": "e61f", - "unicode_decimal": 58911 - }, - { - "icon_id": "397919", - "name": "游戏,游戏机", - "font_class": "youxiyouxiji", - "unicode": "e61e", - "unicode_decimal": 58910 - }, - { - "icon_id": "1766501", - "name": "符号-数字输入框", - "font_class": "shuzishurukuang", - "unicode": "e69c", - "unicode_decimal": 59036 - }, - { - "icon_id": "2571131", - "name": "工具", - "font_class": "gongju1", - "unicode": "e607", - "unicode_decimal": 58887 - }, - { - "icon_id": "11893495", - "name": "时间", - "font_class": "shijian1", - "unicode": "e612", - "unicode_decimal": 58898 - }, - { - "icon_id": "16514476", - "name": "代码", - "font_class": "daima", - "unicode": "e703", - "unicode_decimal": 59139 - }, - { - "icon_id": "23004816", - "name": "流程图", - "font_class": "icon__liuchengtu", - "unicode": "e618", - "unicode_decimal": 58904 - }, - { - "icon_id": "12592146", - "name": "画板", - "font_class": "huaban", - "unicode": "e6e2", - "unicode_decimal": 59106 - }, - { - "icon_id": "3860930", - "name": "时间", - "font_class": "shijian", - "unicode": "e6a0", - "unicode_decimal": 59040 - }, - { - "icon_id": "4517821", - "name": "工具2", - "font_class": "gongju", - "unicode": "e73f", - "unicode_decimal": 59199 - }, - { - "icon_id": "17601072", - "name": "钢琴", - "font_class": "gangqin", - "unicode": "e66c", - "unicode_decimal": 58988 - }, - { - "icon_id": "9149488", - "name": "表格", - "font_class": "biaoge", - "unicode": "e721", - "unicode_decimal": 59169 - }, - { - "icon_id": "1727474", - "name": "234日历", - "font_class": "calendar", - "unicode": "e8cf", - "unicode_decimal": 59599 - }, - { - "icon_id": "698898", - "name": "数字", - "font_class": "number", - "unicode": "e660", - "unicode_decimal": 58976 - }, - { - "icon_id": "8679369", - "name": "主页", - "font_class": "home", - "unicode": "e689", - "unicode_decimal": 59017 - } - ] + "id": "2846995", + "name": "JYeontuComponents", + "font_family": "iconfont", + "css_prefix_text": "icon-", + "description": "", + "glyphs": [ + { + "icon_id": "7093666", + "name": "版本信息", + "font_class": "banbenxinxi", + "unicode": "e71d", + "unicode_decimal": 59165 + }, + { + "icon_id": "773017", + "name": "star", + "font_class": "star", + "unicode": "e681", + "unicode_decimal": 59009 + }, + { + "icon_id": "12550674", + "name": "弹窗", + "font_class": "danchuang", + "unicode": "e63c", + "unicode_decimal": 58940 + }, + { + "icon_id": "18545906", + "name": "悬浮按钮发动态", + "font_class": "xuanfuanniufadongtai", + "unicode": "e6e8", + "unicode_decimal": 59112 + }, + { + "icon_id": "24043661", + "name": "数字递增", + "font_class": "shuzidizeng", + "unicode": "e652", + "unicode_decimal": 58962 + }, + { + "icon_id": "2679664", + "name": "安装包", + "font_class": "anzhuangbao", + "unicode": "e6ef", + "unicode_decimal": 59119 + }, + { + "icon_id": "4579372", + "name": "字符串处理模板", + "font_class": "zifuchuanchulimoban", + "unicode": "e661", + "unicode_decimal": 58977 + }, + { + "icon_id": "8832745", + "name": "龙卷风", + "font_class": "huaban1", + "unicode": "e61f", + "unicode_decimal": 58911 + }, + { + "icon_id": "397919", + "name": "游戏,游戏机", + "font_class": "youxiyouxiji", + "unicode": "e61e", + "unicode_decimal": 58910 + }, + { + "icon_id": "1766501", + "name": "符号-数字输入框", + "font_class": "shuzishurukuang", + "unicode": "e69c", + "unicode_decimal": 59036 + }, + { + "icon_id": "2571131", + "name": "工具", + "font_class": "gongju1", + "unicode": "e607", + "unicode_decimal": 58887 + }, + { + "icon_id": "11893495", + "name": "时间", + "font_class": "shijian1", + "unicode": "e612", + "unicode_decimal": 58898 + }, + { + "icon_id": "16514476", + "name": "代码", + "font_class": "daima", + "unicode": "e703", + "unicode_decimal": 59139 + }, + { + "icon_id": "23004816", + "name": "流程图", + "font_class": "icon__liuchengtu", + "unicode": "e618", + "unicode_decimal": 58904 + }, + { + "icon_id": "12592146", + "name": "画板", + "font_class": "huaban", + "unicode": "e6e2", + "unicode_decimal": 59106 + }, + { + "icon_id": "3860930", + "name": "时间", + "font_class": "shijian", + "unicode": "e6a0", + "unicode_decimal": 59040 + }, + { + "icon_id": "4517821", + "name": "工具2", + "font_class": "gongju", + "unicode": "e73f", + "unicode_decimal": 59199 + }, + { + "icon_id": "17601072", + "name": "钢琴", + "font_class": "gangqin", + "unicode": "e66c", + "unicode_decimal": 58988 + }, + { + "icon_id": "9149488", + "name": "表格", + "font_class": "biaoge", + "unicode": "e721", + "unicode_decimal": 59169 + }, + { + "icon_id": "1727474", + "name": "234日历", + "font_class": "calendar", + "unicode": "e8cf", + "unicode_decimal": 59599 + }, + { + "icon_id": "698898", + "name": "数字", + "font_class": "number", + "unicode": "e660", + "unicode_decimal": 58976 + }, + { + "icon_id": "8679369", + "name": "主页", + "font_class": "home", + "unicode": "e689", + "unicode_decimal": 59017 + } + ] } diff --git a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.ttf b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.ttf index 07b72cb12432953a684da2139d88d63dafeeaaeb..e20d8ac3fd6f12d433eb6c271e29f99dcc9adac3 100644 Binary files a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.ttf and b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.ttf differ diff --git a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff index 8759ba39e0d27fde0de7d26c283dd7267e619225..ed773064ab011a1d9d6e9ee8293c41eaaeb9b1b1 100644 Binary files a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff and b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff differ diff --git a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff2 b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff2 index f91bd3207bb4ae5b697c923627c424bd51a704d9..85c2daceb407bda774dbac93ddfba7c911bd8e60 100644 Binary files a/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff2 and b/JYeontuComponentWarehouse/examples/assets/icon/iconfont.woff2 differ diff --git a/JYeontuComponentWarehouse/examples/components/common/JDropDownBox.vue b/JYeontuComponentWarehouse/examples/components/common/JDropDownBox.vue index 7d713a8ba5e344fe1243a99eff9119f1c18e0e12..c1782631744be857073e1862a56f600022250e99 100644 --- a/JYeontuComponentWarehouse/examples/components/common/JDropDownBox.vue +++ b/JYeontuComponentWarehouse/examples/components/common/JDropDownBox.vue @@ -1,198 +1,208 @@ diff --git a/JYeontuComponentWarehouse/examples/components/common/methodTest.vue b/JYeontuComponentWarehouse/examples/components/common/methodTest.vue index 06b556f88c81271a0922ff0035d431034b87cd74..ce4dc29b9344e064c2eb37ee2f5b9dba7b3ae52b 100644 --- a/JYeontuComponentWarehouse/examples/components/common/methodTest.vue +++ b/JYeontuComponentWarehouse/examples/components/common/methodTest.vue @@ -1,228 +1,265 @@ diff --git a/JYeontuComponentWarehouse/examples/components/menu/left.vue b/JYeontuComponentWarehouse/examples/components/menu/left.vue index 278a35187becfa716a36a5ddaed4650fd0199b37..d36234c07efe05f55ac757f05c9b0e88821a2a00 100644 --- a/JYeontuComponentWarehouse/examples/components/menu/left.vue +++ b/JYeontuComponentWarehouse/examples/components/menu/left.vue @@ -1,137 +1,167 @@ diff --git a/JYeontuComponentWarehouse/examples/components/menu/top.vue b/JYeontuComponentWarehouse/examples/components/menu/top.vue index 8c18c8e637724764d6e79677532cc6d974f35b5d..e674bb4e35b6ab00e70a501a2805efe91458685f 100644 --- a/JYeontuComponentWarehouse/examples/components/menu/top.vue +++ b/JYeontuComponentWarehouse/examples/components/menu/top.vue @@ -1,100 +1,102 @@ diff --git a/JYeontuComponentWarehouse/examples/components/pages/JTabBar.vue b/JYeontuComponentWarehouse/examples/components/pages/JTabBar.vue index 395cb83506e0347d84382660f28e245f5137798e..87e6affd2022900f421fbd17101f1b9ac66af166 100644 --- a/JYeontuComponentWarehouse/examples/components/pages/JTabBar.vue +++ b/JYeontuComponentWarehouse/examples/components/pages/JTabBar.vue @@ -1,89 +1,86 @@ diff --git a/JYeontuComponentWarehouse/examples/components/pages/splitHorizontal.vue b/JYeontuComponentWarehouse/examples/components/pages/splitHorizontal.vue index e11d72fceebbf4b35bf43541efc01a3aba05d10c..96e41e39c8e0dd38af5d496900fb56d65135afdd 100644 --- a/JYeontuComponentWarehouse/examples/components/pages/splitHorizontal.vue +++ b/JYeontuComponentWarehouse/examples/components/pages/splitHorizontal.vue @@ -1,81 +1,80 @@ - + diff --git a/JYeontuComponentWarehouse/examples/config/router.json b/JYeontuComponentWarehouse/examples/config/router.json index 06dbfa9fcbcaa1b83a5c9fdb3ecf8b7220291e62..05194f2e5560701da7e49ba99939407ec5363453 100644 --- a/JYeontuComponentWarehouse/examples/config/router.json +++ b/JYeontuComponentWarehouse/examples/config/router.json @@ -1,178 +1,219 @@ { - "name": "routerConfig", - "menu": [{ - "id": 1, - "name": "home", - "path": "/homePage", - "label": "首页", - "selected": true, - "icon": "icon-home", - "open": true, - "component": "views/homePage/homePage.vue", - "children": [] - },{ - "id": 10, - "name": "installView", - "path": "/installView", - "label": "安装", - "selected": true, - "icon": "icon-anzhuangbao", - "open": true, - "component": "views/installView.vue", - "children": [] - },{ - "id": 2, - "name": "calendar", - "path": "/calendar", - "label": "日历", - "select": false, - "icon": "icon-calendar", - "open": false, - "component": "views/calendar.vue", - "children": [] - },{ - "id": 3, - "name": "electronicNumber", - "path": "/electronicNumber", - "label": "电子屏数字", - "select": false, - "icon": "icon-number", - "open": false, - "component": "views/electronicNumber.vue", - "children": [] - },{ - "id": 5, - "name": "flowChartView", - "path": "/flowChartView", - "label": "流程图", - "select": false, - "icon": "icon-icon__liuchengtu", - "open": false, - "component": "views/flowChartView.vue", - "children": [] - },{ - "id": 6, - "name": "JTableView", - "path": "/JTableView", - "label": "表格", - "select": false, - "icon": "icon-biaoge", - "open": false, - "component": "views/JTableView.vue", - "children": [] - },{ - "id": 7, - "name": "codeHeightLightView", - "path": "/codeHeightLightView", - "label": "代码高亮", - "select": false, - "icon": "icon-daima", - "open": false, - "component": "views/codeHeightLightView.vue", - "children": [] - },{ - "id": 9, - "name": "canvasBroadView", - "path": "/canvasBroadView", - "label": "canvas画板", - "select": false, - "icon": "icon-huaban", - "open": false, - "component": "views/canvasBroadView.vue", - "children": [] - },{ - "id": 11, - "name": "JNumRollingView", - "path": "/JNumRollingView", - "label": "数字滚动变化效果", - "select": false, - "icon": "icon-huaban", - "open": false, - "component": "views/JNumRollingView.vue", - "children": [] - },{ - "id": 12, - "name": "JStepsView", - "path": "/JStepsView", - "label": "步骤条", - "select": false, - "icon": "icon-huaban", - "open": false, - "hide":true, - "component": "views/JStepsView.vue", - "children": [] - },{ - "id": 13, - "name": "JDialogView", - "path": "/JDialogView", - "label": "弹窗", - "select": false, - "icon": "icon-huaban", - "open": false, - "hide":true, - "component": "views/JDialogView.vue", - "children": [] - },{ - "id": 14, - "name": "JHoverBtnView", - "path": "/JHoverBtnView", - "label": "悬浮按钮", - "select": false, - "icon": "icon-huaban", - "open": false, - "component": "views/JHoverBtnView.vue", - "children": [] - },{ - "id": 8, - "name": "utilsTools", - "path": "", - "label": "工具函数", - "select": false, - "icon": "icon-gongju1", - "open": false, - "component": "", - "children": [ - { - "id": 801, - "name": "dateToolView", - "path": "/dateToolView", - "label": "时间处理", - "select": false, - "icon": "icon-shijian1", - "open": false, - "component": "views/utilsTools/dateToolView.vue", - "children": [] - },{ - "id": 802, - "name": "numsFormatView", - "path": "/numsFormatView", - "label": "数字处理", - "select": false, - "icon": "icon-shuzishurukuang", - "open": false, - "component": "views/utilsTools/numsFormatView.vue", - "children": [] - },{ - "id": 803, - "name": "strToolView", - "path": "/strToolView", - "label": "字符串处理", - "select": false, - "icon": "icon-zifuchuanchulimoban", - "open": false, - "component": "views/utilsTools/strToolView.vue", - "children": [] - } - ] - },{ - "id": 4, - "name": "games", - "path": "/games", - "label": "游戏", - "select": false, - "icon": "icon-youxiyouxiji", - "open": false, - "component": "", - "children": [] - }] + "name": "routerConfig", + "iconColor": "deepskyblue", + "menu": [ + { + "id": 1, + "name": "home", + "path": "/homePage", + "label": "首页", + "selected": true, + "icon": "icon-home", + "open": true, + "component": "views/homePage/homePage.vue", + "children": [] + }, + { + "id": 100, + "name": "installView", + "path": "/installView", + "label": "安装", + "selected": false, + "icon": "icon-anzhuangbao", + "open": true, + "component": "views/installView.vue", + "children": [] + }, + { + "id": 200, + "name": "versionInfo", + "path": "/versionInfo", + "label": "版本介绍", + "selected": false, + "icon": "icon-banbenxinxi", + "open": true, + "component": "views/versionInfo.vue", + "children": [] + }, + { + "id": 2, + "name": "calendar", + "path": "/calendar", + "label": "日历", + "selected": false, + "icon": "icon-calendar", + "open": false, + "component": "views/calendar.vue", + "children": [] + }, + { + "id": 3, + "name": "electronicNumber", + "path": "/electronicNumber", + "label": "电子屏数字", + "selected": false, + "icon": "icon-number", + "open": false, + "component": "views/electronicNumber.vue", + "children": [] + }, + { + "id": 5, + "name": "flowChartView", + "path": "/flowChartView", + "label": "流程图", + "selected": false, + "icon": "icon-icon__liuchengtu", + "open": false, + "component": "views/flowChartView.vue", + "children": [] + }, + { + "id": 6, + "name": "JTableView", + "path": "/JTableView", + "label": "表格", + "selected": false, + "icon": "icon-biaoge", + "open": false, + "component": "views/JTableView.vue", + "children": [] + }, + { + "id": 7, + "name": "codeHeightLightView", + "path": "/codeHeightLightView", + "label": "代码高亮", + "selected": false, + "icon": "icon-daima", + "open": false, + "component": "views/codeHeightLightView.vue", + "children": [] + }, + { + "id": 9, + "name": "canvasBroadView", + "path": "/canvasBroadView", + "label": "canvas画板", + "selected": false, + "icon": "icon-huaban", + "open": false, + "component": "views/canvasBroadView.vue", + "children": [] + }, + { + "id": 11, + "name": "JNumRollingView", + "path": "/JNumRollingView", + "label": "数字滚动变化效果", + "selected": false, + "icon": "icon-shuzidizeng", + "open": false, + "component": "views/JNumRollingView.vue", + "children": [] + }, + { + "id": 12, + "name": "JStepsView", + "path": "/JStepsView", + "label": "步骤条", + "selected": false, + "icon": "icon-huaban", + "open": false, + "hide": false, + "component": "views/JStepsView.vue", + "children": [] + }, + { + "id": 13, + "name": "JDialogView", + "path": "/JDialogView", + "label": "弹窗", + "selected": false, + "icon": "icon-danchuang", + "open": false, + "hide": false, + "component": "views/JDialogView.vue", + "children": [] + }, + { + "id": 14, + "name": "JHoverBtnView", + "path": "/JHoverBtnView", + "label": "悬浮按钮", + "selected": false, + "icon": "icon-xuanfuanniufadongtai", + "open": false, + "component": "views/JHoverBtnView.vue", + "children": [] + }, + { + "id": 15, + "name": "JFloatDivView", + "path": "/JFloatDivView", + "label": "div文字环绕效果", + "selected": false, + "icon": "icon-xuanfuanniufadongtai", + "open": false, + "hide": true, + "component": "views/JFloatDivView.vue", + "children": [] + }, + { + "id": 8, + "name": "utilsTools", + "path": "", + "label": "工具函数", + "selected": false, + "icon": "icon-gongju1", + "open": false, + "component": "", + "children": [ + { + "id": 801, + "name": "dateToolView", + "path": "/dateToolView", + "label": "时间处理", + "selected": false, + "icon": "icon-shijian1", + "open": false, + "component": "views/utilsTools/dateToolView.vue", + "children": [] + }, + { + "id": 802, + "name": "numsFormatView", + "path": "/numsFormatView", + "label": "数字处理", + "selected": false, + "icon": "icon-shuzishurukuang", + "open": false, + "component": "views/utilsTools/numsFormatView.vue", + "children": [] + }, + { + "id": 803, + "name": "strToolView", + "path": "/strToolView", + "label": "字符串处理", + "selected": false, + "icon": "icon-zifuchuanchulimoban", + "open": false, + "component": "views/utilsTools/strToolView.vue", + "children": [] + } + ] + }, + { + "id": 4, + "name": "games", + "path": "/games", + "label": "游戏", + "selected": false, + "icon": "icon-youxiyouxiji", + "open": false, + "component": "", + "children": [] + } + ] } diff --git a/JYeontuComponentWarehouse/examples/main.js b/JYeontuComponentWarehouse/examples/main.js index e2c4639f436a5e099d175c3b6a27ee54010180cb..06dd6d581b310a5da4af150479b5b40603a716db 100644 --- a/JYeontuComponentWarehouse/examples/main.js +++ b/JYeontuComponentWarehouse/examples/main.js @@ -1,21 +1,21 @@ /* eslint-disable no-unused-vars,no-undef */ -import Vue from 'vue' -import App from './App.vue' -import ElementUI from 'element-ui' -import router from './router' -import 'element-ui/lib/theme-chalk/index.css' -import '@/assets/icon/iconfont.css' +import Vue from "vue"; +import App from "./App.vue"; +import ElementUI from "element-ui"; +import router from "./router"; +import "element-ui/lib/theme-chalk/index.css"; +import "@/assets/icon/iconfont.css"; // 导入组件库 -import jvuewhell from './../packages/index' +import jvuewhell from "./../packages/index"; // 注册组件库 -Vue.use(jvuewhell) -Vue.use(ElementUI) +Vue.use(jvuewhell); +Vue.use(ElementUI); Vue.config.devtools = true; -Vue.config.productionTip = false +Vue.config.productionTip = false; new Vue({ - router, - render: h => h(App) -}).$mount('#app') + router, + render: h => h(App) +}).$mount("#app"); diff --git a/JYeontuComponentWarehouse/examples/router/index.js b/JYeontuComponentWarehouse/examples/router/index.js index d15c3529d8268cf69df00ff422f4e81cb212973c..9a98924b5f626622ee8872a79747e614420cc929 100644 --- a/JYeontuComponentWarehouse/examples/router/index.js +++ b/JYeontuComponentWarehouse/examples/router/index.js @@ -1,40 +1,43 @@ -import Vue from 'vue' -import VueRouter from 'vue-router' +import Vue from "vue"; +import VueRouter from "vue-router"; -Vue.use(VueRouter) +Vue.use(VueRouter); -const originalPush = VueRouter.prototype.push -VueRouter.prototype.push = function push (location) { - return originalPush.call(this, location).catch(err => err) -} +const originalPush = VueRouter.prototype.push; +VueRouter.prototype.push = function push(location) { + return originalPush.call(this, location).catch(err => err); +}; -let routerMenu = require('@/config/router.json') -routerMenu = routerMenu.menu -let menu = [] -let formatRoute = function (routerMenu, menu) { - for (let i = 0; i < routerMenu.length; i++) { - let temp = { - path: routerMenu[i].path, - name: routerMenu[i].name, - // 用require这种方式引入的时候,会将你的component分别打包成不同的js,加载的时候也是按需加载,只用访问这个路由网址时才会加载这个js - component: resolve => require([`@/${routerMenu[i].component}`], resolve) +let routerMenu = require("@/config/router.json"); +routerMenu = routerMenu.menu; +let menu = []; +let formatRoute = function(routerMenu, menu) { + for (let i = 0; i < routerMenu.length; i++) { + let temp = { + path: routerMenu[i].path, + name: routerMenu[i].name, + // 用require这种方式引入的时候,会将你的component分别打包成不同的js,加载的时候也是按需加载,只用访问这个路由网址时才会加载这个js + component: resolve => + require([`@/${routerMenu[i].component}`], resolve) + }; + menu.push(temp); + if (routerMenu[i].children && routerMenu[i].children.length > 0) { + formatRoute(routerMenu[i].children, menu); + } } - menu.push(temp) - if (routerMenu[i].children && routerMenu[i].children.length > 0) { - formatRoute(routerMenu[i].children, menu) +}; +formatRoute(routerMenu, menu); +const routes = [ + { + path: "/", + redirect: "/homePage" } - } +]; +for (let i = 0; i < menu.length; i++) { + routes.push(menu[i]); } -formatRoute(routerMenu, menu) -const routes = [ - { - path: '/', - redirect: '/homePage' - } -] -for (let i = 0; i < menu.length; i++) { routes.push(menu[i]) } const router = new VueRouter({ - routes -}) + routes +}); -export default router +export default router; diff --git a/JYeontuComponentWarehouse/examples/utils/dateTool.js b/JYeontuComponentWarehouse/examples/utils/dateTool.js index f9604725b5784fd89b91c4763ca7fdfd33b9cfa5..6a94f70293495c9480487f90090c697431a90e84 100644 --- a/JYeontuComponentWarehouse/examples/utils/dateTool.js +++ b/JYeontuComponentWarehouse/examples/utils/dateTool.js @@ -4,21 +4,21 @@ * @return {Boolean} */ -export const isLeap = function (year) { - if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) { - return true +export const isLeap = function(year) { + if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) { + return true; } - return false + return false; }; /** * 获取星期 * @param {string} date 日期 * @return {string} 星期 */ -export const getWeek = function (date) { - let Stamp = new Date(date) +export const getWeek = function(date) { + let Stamp = new Date(date); // return weeks[Stamp.getDay()]; - let weeks = ['日','一','二','三','四','五','六']; + let weeks = ["日", "一", "二", "三", "四", "五", "六"]; return weeks[Stamp.getDay()]; }; /** @@ -27,30 +27,30 @@ export const getWeek = function (date) { * @param {string} month 月份 * @return {number} 月份天数 */ -export const getMonthDays = function (year, month) { - month = parseInt(month) - 1 - if (month < 0 || month > 11) return '' - let months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] +export const getMonthDays = function(year, month) { + month = parseInt(month) - 1; + if (month < 0 || month > 11) return ""; + let months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (isLeap(year)) { - months[1] = 29 + months[1] = 29; } - return months[month] + return months[month]; }; /** * 数字补零 * @param {string} str * @return {string} */ -export const zero = function (str) { - str = parseInt(str) - return str > 9 ? str : '0' + str +export const zero = function(str) { + str = parseInt(str); + return str > 9 ? str : "0" + str; }; /** * 获取今天日期 * @param {string} str 日期格式 * @return {string} 格式化日期 */ -export const getToday = function (str = "yyyy-mm-dd") { +export const getToday = function(str = "yyyy-mm-dd") { const date = new Date(); const year = date.getFullYear(), month = zero(date.getMonth() + 1), @@ -58,54 +58,65 @@ export const getToday = function (str = "yyyy-mm-dd") { hour = zero(date.getHours()), minute = zero(date.getMinutes()), second = zero(date.getSeconds()); - let res = ''; - switch (str){ + let res = ""; + switch (str) { case "yyyy-mm-dd": - res = year + '-' + month + '-' + day; + res = year + "-" + month + "-" + day; break; case "mm-dd-yyyy": - res = month + '-' + day + '-' + year; + res = month + "-" + day + "-" + year; break; case "yyyy-mm-dd hh:MM:ss": - res = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; + res = + year + + "-" + + month + + "-" + + day + + " " + + hour + + ":" + + minute + + ":" + + second; break; case "hh:MM:ss": - res = hour + ':' + minute + ':' + second; + res = hour + ":" + minute + ":" + second; break; case "yyyy": res = year; break; - case "mm": - res = month; - break; - case "dd": - res = day; - break; - case "hh": - res = hour; - break; - case "MM": - res = minute; - break; - case "ss": - res = second; - break; + case "mm": + res = month; + break; + case "dd": + res = day; + break; + case "hh": + res = hour; + break; + case "MM": + res = minute; + break; + case "ss": + res = second; + break; case "mm-dd": - res = month + '-' + day; + res = month + "-" + day; break; default: - res = '参数错误'; + res = "参数错误"; break; } return res; -} +}; /** * 将时间按照所传入的时间格式进行转换 * @param {string} value 日期 * @param {string} formatStr 日期格式 * @return {string} 格式化日期 */ -export const dateFormat = function (value,formatStr = 'yyyy-mm-dd') { +export const dateFormat = function(value, formatStr = "yyyy-mm-dd") { const date = new Date(value); const year = date.getFullYear(), month = zero(date.getMonth() + 1), @@ -113,115 +124,128 @@ export const dateFormat = function (value,formatStr = 'yyyy-mm-dd') { hour = zero(date.getHours()), minute = zero(date.getMinutes()), second = zero(date.getSeconds()); - let res = ''; - switch (formatStr){ + let res = ""; + switch (formatStr) { case "yyyy-mm-dd": - res = year + '-' + month + '-' + day; + res = year + "-" + month + "-" + day; break; case "mm-dd-yyyy": - res = month + '-' + day + '-' + year; + res = month + "-" + day + "-" + year; break; case "yyyy-mm-dd hh:MM:ss": - res = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; + res = + year + + "-" + + month + + "-" + + day + + " " + + hour + + ":" + + minute + + ":" + + second; break; case "hh:MM:ss": - res = hour + ':' + minute + ':' + second; + res = hour + ":" + minute + ":" + second; break; case "yyyy": res = year; - break; - case "mm": - res = month; - break; - case "dd": - res = day; - break; - case "hh": - res = hour; - break; - case "MM": - res = minute; - break; - case "ss": - res = second; + break; + case "mm": + res = month; + break; + case "dd": + res = day; + break; + case "hh": + res = hour; + break; + case "MM": + res = minute; + break; + case "ss": + res = second; break; case "mm-dd": - res = month + '-' + day; + res = month + "-" + day; break; default: - res = '参数错误'; + res = "参数错误"; break; } return res; -} +}; /** * 获取上一天日期 * @param {string} str 当前日期 * @return {string} 上一天日期 */ -export const getYesterday = function (str) { - let date = str.split('-'); +export const getYesterday = function(str) { + let date = str.split("-"); let year = parseInt(date[0]), month = parseInt(date[1]), day = parseInt(date[2]); - if(month > 12 || month < 1 || day > getMonthDays(year,month)) return '日期不合法'; + if (month > 12 || month < 1 || day > getMonthDays(year, month)) + return "日期不合法"; day -= 1; - if(day > 0){ - return year + '-' + zero(month) + '-' + zero(day); + if (day > 0) { + return year + "-" + zero(month) + "-" + zero(day); } month -= 1; - if(month > 0){ - return year + '-' + zero(month) + '-' + getMonthDays(year,month); + if (month > 0) { + return year + "-" + zero(month) + "-" + getMonthDays(year, month); } year -= 1; - return year + '-' + 12 + '-' + getMonthDays(year,12); + return year + "-" + 12 + "-" + getMonthDays(year, 12); }; /** * 获取下一天日期 * @param {string} str 当前日期 * @return {string} 下一天日期 */ -export const getTomorrow = function (str){ - let date = str.split('-'); +export const getTomorrow = function(str) { + let date = str.split("-"); let year = parseInt(date[0]), month = parseInt(date[1]), day = parseInt(date[2]); - if(month > 12 || month < 1 || day > getMonthDays(year,month)) return '日期不合法'; + if (month > 12 || month < 1 || day > getMonthDays(year, month)) + return "日期不合法"; day += 1; - if(day <= getMonthDays(year,month)){ - return year + '-' + zero(month) + '-' + zero(day); + if (day <= getMonthDays(year, month)) { + return year + "-" + zero(month) + "-" + zero(day); } month += 1; - if(month < 13){ - return year + '-' + zero(month) + '-' + '01'; + if (month < 13) { + return year + "-" + zero(month) + "-" + "01"; } year += 1; - return year + '-' + '01' + '-' + '01'; -} + return year + "-" + "01" + "-" + "01"; +}; /** * 获取前n天日期 * @param {string} n 当前日期 * @return {string} 前n天日期 */ -export const beforeDay = function (date,n){ - if(date.split('-').length < 3) return '日期格式错误'; - let res = dateFormat(date); - n = parseInt(n); - while(n--){ - res = getYesterday(res); - } - return res; -} +export const beforeDay = function(date, n) { + if (date.split("-").length < 3) return "日期格式错误"; + let res = dateFormat(date); + n = parseInt(n); + while (n--) { + res = getYesterday(res); + } + return res; +}; /** * 获取后n天日期 * @param {string} n 当前日期 * @return {string} 后n天日期 */ -export const afterDay = function (date,n){ - if(date.split('-').length < 3) return '日期格式错误'; - let res = dateFormat(date); - while(n--){ - res = getTomorrow(res); - } - return res; -} +export const afterDay = function(date, n) { + if (date.split("-").length < 3) return "日期格式错误"; + let res = dateFormat(date); + while (n--) { + res = getTomorrow(res); + } + return res; +}; diff --git a/JYeontuComponentWarehouse/examples/utils/numsFormat.js b/JYeontuComponentWarehouse/examples/utils/numsFormat.js index 515a2af7b2fcfe6ff2ae5b8d633639029378d7d2..3da1c0099c3c4d2c4cf6444d8eafd590f3a48821 100644 --- a/JYeontuComponentWarehouse/examples/utils/numsFormat.js +++ b/JYeontuComponentWarehouse/examples/utils/numsFormat.js @@ -4,12 +4,45 @@ * @return {string} 英文表示 **/ export const numberToWords = function(num) { - const singles = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]; - const teens = ["Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"]; - const tens = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; + const singles = [ + "", + "One", + "Two", + "Three", + "Four", + "Five", + "Six", + "Seven", + "Eight", + "Nine" + ]; + const teens = [ + "Ten", + "Eleven", + "Twelve", + "Thirteen", + "Fourteen", + "Fifteen", + "Sixteen", + "Seventeen", + "Eighteen", + "Nineteen" + ]; + const tens = [ + "", + "Ten", + "Twenty", + "Thirty", + "Forty", + "Fifty", + "Sixty", + "Seventy", + "Eighty", + "Ninety" + ]; const thousands = ["", "Thousand", "Million", "Billion"]; - const toEnglish = (num) => { + const toEnglish = num => { const curr = []; const hundred = Math.floor(num / 100); num %= 100; @@ -26,21 +59,25 @@ export const numberToWords = function(num) { } else if (num >= 10) { curr.push(teens[num - 10] + " "); } - return curr.join(''); - } + return curr.join(""); + }; if (num === 0) { return "Zero"; } const sb = []; - for (let i = 3, unit = 1000000000; i >= 0; i--, unit = Math.floor(unit / 1000)) { + for ( + let i = 3, unit = 1000000000; + i >= 0; + i--, unit = Math.floor(unit / 1000) + ) { const curNum = Math.floor(num / unit); if (curNum !== 0) { num -= curNum * unit; sb.push(toEnglish(curNum) + thousands[i] + " "); } } - return sb.join('').trim(); + return sb.join("").trim(); }; /** * @description 数字转换为大写中文表示 @@ -48,164 +85,179 @@ export const numberToWords = function(num) { * @return {string} 大写中文表示 **/ export const numberToChineseWords = money => { - // 汉字的数字 - const cnNums = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] - // 基本单位 - const cnIntRadice = ['', '拾', '佰', '仟'] - // 对应整数部分扩展单位 - const cnIntUnits = ['', '万', '亿', '兆'] - // 对应小数部分单位 - const cnDecUnits = ['角', '分', '毫', '厘'] - // 整数金额时后面跟的字符 - const cnInteger = '整' - // 整型完以后的单位 - const cnIntLast = '元' - // 最大处理的数字 - const maxNum = 9999999999999999.99 - // 金额整数部分 - let integerNum - // 金额小数部分 - let decimalNum - // 输出的中文金额字符串 - let chineseStr = '' - // 分离金额后用的数组,预定义 - let parts - if (money === '') { return '' } - money = parseFloat(money) - if (money >= maxNum) { - // 超出最大处理数字 - return '' - } - if (money === 0) { - chineseStr = cnNums[0] + cnIntLast + cnInteger - return chineseStr - } - // 转换为字符串 - money = money.toString() - if (money.indexOf('.') === -1) { - integerNum = money - decimalNum = '' - } else { - parts = money.split('.') - integerNum = parts[0] - decimalNum = parts[1].substr(0, 4) - } - console.log(integerNum, decimalNum) - // 获取整型部分转换 - if (parseInt(integerNum, 10) > 0) { - var zeroCount = 0 - var IntLen = integerNum.length - for (var i = 0; i < IntLen; i++) { - let n = integerNum.substr(i, 1) - let p = IntLen - i - 1 - let q = p / 4 - let m = p % 4 - if (n === '0') { - zeroCount++ - } else { - if (zeroCount > 0) { - chineseStr += cnNums[0] + // 汉字的数字 + const cnNums = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"]; + // 基本单位 + const cnIntRadice = ["", "拾", "佰", "仟"]; + // 对应整数部分扩展单位 + const cnIntUnits = ["", "万", "亿", "兆"]; + // 对应小数部分单位 + const cnDecUnits = ["角", "分", "毫", "厘"]; + // 整数金额时后面跟的字符 + const cnInteger = "整"; + // 整型完以后的单位 + const cnIntLast = "元"; + // 最大处理的数字 + const maxNum = 9999999999999999.99; + // 金额整数部分 + let integerNum; + // 金额小数部分 + let decimalNum; + // 输出的中文金额字符串 + let chineseStr = ""; + // 分离金额后用的数组,预定义 + let parts; + if (money === "") { + return ""; + } + money = parseFloat(money); + if (money >= maxNum) { + // 超出最大处理数字 + return ""; + } + if (money === 0) { + chineseStr = cnNums[0] + cnIntLast + cnInteger; + return chineseStr; + } + // 转换为字符串 + money = money.toString(); + if (money.indexOf(".") === -1) { + integerNum = money; + decimalNum = ""; + } else { + parts = money.split("."); + integerNum = parts[0]; + decimalNum = parts[1].substr(0, 4); + } + console.log(integerNum, decimalNum); + // 获取整型部分转换 + if (parseInt(integerNum, 10) > 0) { + var zeroCount = 0; + var IntLen = integerNum.length; + for (var i = 0; i < IntLen; i++) { + let n = integerNum.substr(i, 1); + let p = IntLen - i - 1; + let q = p / 4; + let m = p % 4; + if (n === "0") { + zeroCount++; + } else { + if (zeroCount > 0) { + chineseStr += cnNums[0]; + } + // 归零 + zeroCount = 0; + chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]; + } + if (m === 0 && zeroCount < 4) { + chineseStr += cnIntUnits[q]; + } + } + chineseStr += cnIntLast; + } + // 小数部分 + if (decimalNum !== "") { + var decLen = decimalNum.length; + for (let i = 0; i < decLen; i++) { + let n = decimalNum.substr(i, 1); + if (n !== "0") { + chineseStr += cnNums[Number(n)] + cnDecUnits[i]; + } } - // 归零 - zeroCount = 0 - chineseStr += cnNums[parseInt(n)] + cnIntRadice[m] - } - if (m === 0 && zeroCount < 4) { - chineseStr += cnIntUnits[q] - } } - chineseStr += cnIntLast - } - // 小数部分 - if (decimalNum !== '') { - var decLen = decimalNum.length - for (let i = 0; i < decLen; i++) { - let n = decimalNum.substr(i, 1) - if (n !== '0') { - chineseStr += cnNums[Number(n)] + cnDecUnits[i] - } + if (chineseStr === "") { + chineseStr += cnNums[0] + cnIntLast + cnInteger; + } else if (decimalNum === "") { + chineseStr += cnInteger; } - } - if (chineseStr === '') { - chineseStr += cnNums[0] + cnIntLast + cnInteger - } else if (decimalNum === '') { - chineseStr += cnInteger - } - return chineseStr + return chineseStr; }; /** * @description 数字千分位分隔 * @param {String} num 数字 - * @param {String} separator 分隔符,默认为英文逗号',' - * @return {String} 千分位分隔后的数字 + * @param {String} separator 分隔符,默认为英文逗号',' + * @return {String} 千分位分隔后的数字 **/ - export const numberToSplitWords = function(num,separator=','){ - num = num.toString(); - if(num.length < 3) return num; - let flag = ''; - if(num[0] == '-'){ - flag = '-'; - num = num.substr(1); - } - num = num.split('.'); - const num1 = num[0],len1 = num[0].length; - let res = ''; - for(let i = 0; i < num1.length; i++){ - if(i != 0 && i % 3 == 0){ - res = separator + res; - } - res = num1[len1 - i - 1] + res; - } - if(num.length > 1){ - res += '.'; - const num2 = num[1],len2 = num[1].length; - for(let i = 0; i < num2.length; i++){ - if(i != 0 && i % 3 == 0){ - res += separator; - } - res += num2[i]; - } - } - return flag + res; - }; - - /** - * @description 整数转罗马数字 - * @param {number} num 整数 - * @return {string} 罗马数字 - */ +export const numberToSplitWords = function(num, separator = ",") { + num = num.toString(); + if (num.length < 3) return num; + let flag = ""; + if (num[0] == "-") { + flag = "-"; + num = num.substr(1); + } + num = num.split("."); + const num1 = num[0], + len1 = num[0].length; + let res = ""; + for (let i = 0; i < num1.length; i++) { + if (i != 0 && i % 3 == 0) { + res = separator + res; + } + res = num1[len1 - i - 1] + res; + } + if (num.length > 1) { + res += "."; + const num2 = num[1], + len2 = num[1].length; + for (let i = 0; i < num2.length; i++) { + if (i != 0 && i % 3 == 0) { + res += separator; + } + res += num2[i]; + } + } + return flag + res; +}; + +/** + * @description 整数转罗马数字 + * @param {number} num 整数 + * @return {string} 罗马数字 + */ export const intToRoman = function(num) { - //num > 0 && num <= 3999 - if(num <= 0 || num > 3999) return '数字范围应该为1~3999'; + //num > 0 && num <= 3999 + if (num <= 0 || num > 3999) return "数字范围应该为1~3999"; const thousands = ["", "M", "MM", "MMM"]; - const hundreds = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"]; - const tens = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]; - const ones = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; + const hundreds = [ + "", + "C", + "CC", + "CCC", + "CD", + "D", + "DC", + "DCC", + "DCCC", + "CM" + ]; + const tens = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]; + const ones = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; const roman = []; - num = parseInt(num); + num = parseInt(num); roman.push(thousands[Math.floor(num / 1000)]); - roman.push(hundreds[Math.floor(num % 1000 / 100)]); - roman.push(tens[Math.floor(num % 100 / 10)]); + roman.push(hundreds[Math.floor((num % 1000) / 100)]); + roman.push(tens[Math.floor((num % 100) / 10)]); roman.push(ones[num % 10]); - return roman.join(''); + return roman.join(""); }; /** - * @description 罗马数字转整数 + * @description 罗马数字转整数 * @param {string} s 罗马数字 * @return {number} 整数 */ export const romanToInt = function(s) { const symbolValues = new Map(); - symbolValues.set('I', 1); - symbolValues.set('V', 5); - symbolValues.set('X', 10); - symbolValues.set('L', 50); - symbolValues.set('C', 100); - symbolValues.set('D', 500); - symbolValues.set('M', 1000); + symbolValues.set("I", 1); + symbolValues.set("V", 5); + symbolValues.set("X", 10); + symbolValues.set("L", 50); + symbolValues.set("C", 100); + symbolValues.set("D", 500); + symbolValues.set("M", 1000); let ans = 0; const n = s.length; for (let i = 0; i < n; ++i) { diff --git a/JYeontuComponentWarehouse/examples/utils/strTool.js b/JYeontuComponentWarehouse/examples/utils/strTool.js index 20a4e2416759b52953e4af8ef8efbe0624db0aaf..0cedd52827fd2b22002b498f0ae0fc78810b614c 100644 --- a/JYeontuComponentWarehouse/examples/utils/strTool.js +++ b/JYeontuComponentWarehouse/examples/utils/strTool.js @@ -3,45 +3,45 @@ * @param {String} str 需要转换的字符串 * @return {String} 小驼峰形式字符串 **/ -export const _toLittleCamel = function(str){ - let newStr = str.split('-'); - if(newStr.length <= 1) return str; - let res = newStr[0]; - for(let i = 1; i < newStr.length; i++){ - res += newStr[i][0].toUpperCase() + newStr[i].substr(1); - } - return res; -} +export const _toLittleCamel = function(str) { + let newStr = str.split("-"); + if (newStr.length <= 1) return str; + let res = newStr[0]; + for (let i = 1; i < newStr.length; i++) { + res += newStr[i][0].toUpperCase() + newStr[i].substr(1); + } + return res; +}; /** * @description '-'连接命名转换成大驼峰命名 * @param {String} str 需要转换的字符串 * @return {String} 大驼峰形式字符串 **/ -export const _toBigCamel = function(str){ - let newStr = str.split('-'); - if(newStr.length <= 1) return str; - let res = ''; - for(let i = 0; i < newStr.length; i++){ - res += newStr[i][0].toUpperCase() + newStr[i].substr(1); - } - return res; -} +export const _toBigCamel = function(str) { + let newStr = str.split("-"); + if (newStr.length <= 1) return str; + let res = ""; + for (let i = 0; i < newStr.length; i++) { + res += newStr[i][0].toUpperCase() + newStr[i].substr(1); + } + return res; +}; /** * @description 驼峰命名转换成'-'连接命名 * @param {String} str 需要转换的字符串 * @return {String} '-'连接形式字符串 **/ -export const camelTo_ = function(str){ - let res = ''; - for(let i = 0; i < str.length; i++){ - if(str[i] >= 'A' && str[i] <= 'Z'){ - if(i == 0) res += str[i].toLowerCase(); - else{ - res += '-' + str[i].toLowerCase(); - } - }else{ - res += str[i]; - } - } - return res; -} +export const camelTo_ = function(str) { + let res = ""; + for (let i = 0; i < str.length; i++) { + if (str[i] >= "A" && str[i] <= "Z") { + if (i == 0) res += str[i].toLowerCase(); + else { + res += "-" + str[i].toLowerCase(); + } + } else { + res += str[i]; + } + } + return res; +}; diff --git a/JYeontuComponentWarehouse/examples/views/JDialogView.vue b/JYeontuComponentWarehouse/examples/views/JDialogView.vue index 04969928f389b11f738aaf835236fdb3773185af..09396b424598f3edf830f737f3927f4dc6ed9b73 100644 --- a/JYeontuComponentWarehouse/examples/views/JDialogView.vue +++ b/JYeontuComponentWarehouse/examples/views/JDialogView.vue @@ -1,202 +1,204 @@ diff --git a/JYeontuComponentWarehouse/examples/views/JFloatDivView.vue b/JYeontuComponentWarehouse/examples/views/JFloatDivView.vue new file mode 100644 index 0000000000000000000000000000000000000000..d297efe6c225c37565aea79d7c80f88da70e4ef8 --- /dev/null +++ b/JYeontuComponentWarehouse/examples/views/JFloatDivView.vue @@ -0,0 +1,7 @@ + + + + + diff --git a/JYeontuComponentWarehouse/examples/views/JHoverBtnView.vue b/JYeontuComponentWarehouse/examples/views/JHoverBtnView.vue index e679b8882061231d58413b20e2bd673baa8d231e..89840fe724d202924c68dc83f6baf0f4c9ec7d07 100644 --- a/JYeontuComponentWarehouse/examples/views/JHoverBtnView.vue +++ b/JYeontuComponentWarehouse/examples/views/JHoverBtnView.vue @@ -1,160 +1,161 @@ diff --git a/JYeontuComponentWarehouse/examples/views/JNumRollingView.vue b/JYeontuComponentWarehouse/examples/views/JNumRollingView.vue index 4944411c3c546e3cf61c8c446d9a72a4cdb74d5b..71f4e7cc7bd4bbbd6e067d679f88d9e2ceef3ee9 100644 --- a/JYeontuComponentWarehouse/examples/views/JNumRollingView.vue +++ b/JYeontuComponentWarehouse/examples/views/JNumRollingView.vue @@ -1,145 +1,142 @@ diff --git a/JYeontuComponentWarehouse/examples/views/JStepsView.vue b/JYeontuComponentWarehouse/examples/views/JStepsView.vue index af62b18efdbec9c4488927b852056d8cbea413c1..b6e1f4d82ce14cc3a5fd5bdf8ae877f49b7891fa 100644 --- a/JYeontuComponentWarehouse/examples/views/JStepsView.vue +++ b/JYeontuComponentWarehouse/examples/views/JStepsView.vue @@ -1,202 +1,256 @@ diff --git a/JYeontuComponentWarehouse/examples/views/JTableView.vue b/JYeontuComponentWarehouse/examples/views/JTableView.vue index 3ae82a9a72edd4211c3a88ddb2049ac3d89af53a..d2bf341f5681e136f87197f3616d32f27fe9d6c6 100644 --- a/JYeontuComponentWarehouse/examples/views/JTableView.vue +++ b/JYeontuComponentWarehouse/examples/views/JTableView.vue @@ -1,275 +1,438 @@ diff --git a/JYeontuComponentWarehouse/examples/views/calendar.vue b/JYeontuComponentWarehouse/examples/views/calendar.vue index 0af310de2629e6e150e5bd1e7d2056fdce38f8c8..a950f4e93d5928a048a84258d7790b1f5366da8b 100644 --- a/JYeontuComponentWarehouse/examples/views/calendar.vue +++ b/JYeontuComponentWarehouse/examples/views/calendar.vue @@ -1,125 +1,121 @@ diff --git a/JYeontuComponentWarehouse/examples/views/canvasBroadView.vue b/JYeontuComponentWarehouse/examples/views/canvasBroadView.vue index 55b659f835a17a6c8770a73432a83927919e77bf..1c85f55b963d6f7a15c0488221305c2c9de90c73 100644 --- a/JYeontuComponentWarehouse/examples/views/canvasBroadView.vue +++ b/JYeontuComponentWarehouse/examples/views/canvasBroadView.vue @@ -1,140 +1,138 @@ diff --git a/JYeontuComponentWarehouse/examples/views/codeHeightLightView.vue b/JYeontuComponentWarehouse/examples/views/codeHeightLightView.vue index acce47d780baec0fdd359d3062068a9cf9bd4c96..0fa616c3a2947412b088777ba684816c48d7bff1 100644 --- a/JYeontuComponentWarehouse/examples/views/codeHeightLightView.vue +++ b/JYeontuComponentWarehouse/examples/views/codeHeightLightView.vue @@ -1,120 +1,124 @@ diff --git a/JYeontuComponentWarehouse/examples/views/electronicNumber.vue b/JYeontuComponentWarehouse/examples/views/electronicNumber.vue index f08476d25d71f46b2f318b70134cdabe92308d8d..3a2a8dc5d4fec89b6b72903b3ad1c7d8acfd20a5 100644 --- a/JYeontuComponentWarehouse/examples/views/electronicNumber.vue +++ b/JYeontuComponentWarehouse/examples/views/electronicNumber.vue @@ -1,120 +1,116 @@ diff --git a/JYeontuComponentWarehouse/examples/views/flowChartView.vue b/JYeontuComponentWarehouse/examples/views/flowChartView.vue index ba5299f8386f56416d448e144e9b75ef7074c910..7ff0f9b4d7c25c4a200502bdfb6d134c571ed295 100644 --- a/JYeontuComponentWarehouse/examples/views/flowChartView.vue +++ b/JYeontuComponentWarehouse/examples/views/flowChartView.vue @@ -1,183 +1,178 @@ diff --git a/JYeontuComponentWarehouse/examples/views/homePage/homePage.vue b/JYeontuComponentWarehouse/examples/views/homePage/homePage.vue index c8f1de101fd5e6b97df353078f9bb41969214e46..87a9cf31559b396a1ba03cadc0ab11063c5394eb 100644 --- a/JYeontuComponentWarehouse/examples/views/homePage/homePage.vue +++ b/JYeontuComponentWarehouse/examples/views/homePage/homePage.vue @@ -1,60 +1,64 @@ diff --git a/JYeontuComponentWarehouse/examples/views/installView.vue b/JYeontuComponentWarehouse/examples/views/installView.vue index e2df01e23303064a85c9c16f53627b9172be6190..d658cdcee87a12c8d84c5328cf20917ac0dacc7e 100644 --- a/JYeontuComponentWarehouse/examples/views/installView.vue +++ b/JYeontuComponentWarehouse/examples/views/installView.vue @@ -1,59 +1,59 @@ - + diff --git a/JYeontuComponentWarehouse/examples/views/utilsTools/dateToolView.vue b/JYeontuComponentWarehouse/examples/views/utilsTools/dateToolView.vue index 599b5108f7a02b4866e92863bbd5c8b24fc20f3f..f4d50a938a033199b85683d77dfd8377d4da989b 100644 --- a/JYeontuComponentWarehouse/examples/views/utilsTools/dateToolView.vue +++ b/JYeontuComponentWarehouse/examples/views/utilsTools/dateToolView.vue @@ -1,193 +1,192 @@ diff --git a/JYeontuComponentWarehouse/examples/views/utilsTools/numsFormatView.vue b/JYeontuComponentWarehouse/examples/views/utilsTools/numsFormatView.vue index e8cd4362b5106dd681458345d25951946e878de1..623d67767beccea847a03864a690415aab00e125 100644 --- a/JYeontuComponentWarehouse/examples/views/utilsTools/numsFormatView.vue +++ b/JYeontuComponentWarehouse/examples/views/utilsTools/numsFormatView.vue @@ -1,168 +1,167 @@ diff --git a/JYeontuComponentWarehouse/examples/views/utilsTools/strToolView.vue b/JYeontuComponentWarehouse/examples/views/utilsTools/strToolView.vue index b3b62195eb9b65c2990170f37880316f6add7ddb..def005516bb56e01bda5354a75ed6f3a1957957c 100644 --- a/JYeontuComponentWarehouse/examples/views/utilsTools/strToolView.vue +++ b/JYeontuComponentWarehouse/examples/views/utilsTools/strToolView.vue @@ -1,136 +1,133 @@ diff --git a/JYeontuComponentWarehouse/examples/views/versionInfo.vue b/JYeontuComponentWarehouse/examples/views/versionInfo.vue new file mode 100644 index 0000000000000000000000000000000000000000..00dbd8f9aa2dfe9b39b7f39d155ad124ad41cbcd --- /dev/null +++ b/JYeontuComponentWarehouse/examples/views/versionInfo.vue @@ -0,0 +1,100 @@ + + + + + diff --git a/JYeontuComponentWarehouse/jsconfig.json b/JYeontuComponentWarehouse/jsconfig.json index c6ca8ba62451796bc77878372c2b0d1976614806..0e1486fd2bfe7caff004b8f2ace9df916c156abe 100644 --- a/JYeontuComponentWarehouse/jsconfig.json +++ b/JYeontuComponentWarehouse/jsconfig.json @@ -1,9 +1,9 @@ -{ - "compilerOptions": { - "baseUrl": "./", - "paths": { - "@/*": ["examples/*"] - } - }, - "exclude": ["node_modules", "dist"] -} \ No newline at end of file +{ + "compilerOptions": { + "baseUrl": "./", + "paths": { + "@/*": ["examples/*"] + } + }, + "exclude": ["node_modules", "dist"] +} diff --git a/JYeontuComponentWarehouse/package.json b/JYeontuComponentWarehouse/package.json index 38f505f66dee4eaa83e69d2a8e4778f7521e7f1e..3d2a3914cc116331517939b63407570440d8e07f 100644 --- a/JYeontuComponentWarehouse/package.json +++ b/JYeontuComponentWarehouse/package.json @@ -1,39 +1,52 @@ { - "name": "@jyeontu/jvuewheel", - "version": "0.1.4", - "license": "MIT", - "keyword": "vue components", - "description":"vue组件库封装", - "main": "lib/jvuewhell.umd.min.js", - "scripts": { - "serve": "set port=8081 && vue-cli-service serve", - "build": "vue-cli-service build", - "lint": "vue-cli-service lint", - "lib": "vue-cli-service build --target lib --name jvuewhell --dest lib packages/index.js" - }, - "dependencies": { - "@typescript-eslint/eslint-plugin": "^4.28.2", - "@typescript-eslint/parser": "^4.28.2", - "core-js": "^2.6.5", - "element-ui": "^2.15.3", - "highlight.js": "^11.3.1", - "node-sass": "^4.14.1", - "sass": "^1.37.5", - "scss": "^0.2.4", - "scss-loader": "0.0.1", - "vue": "^2.6.10", - "vue-codemirror": "^4.0.6", - "vue-highlightjs": "^1.3.3", - "vue-router": "^3.5.2" - }, - "devDependencies": { - "eslint-config-standard": "12.0.0", - "sass-loader": "^8.0.2", - "style-loader": "^3.2.1", - "vue-style-loader": "^4.1.3", - "@vue/cli-plugin-babel": "^3.8.0", - "@vue/cli-service": "^3.8.0", - "vue-template-compiler": "^2.6.10", - "compression-webpack-plugin": "^8.0.1" - } + "name": "@jyeontu/jvuewheel", + "version": "0.1.4", + "license": "MIT", + "keyword": "vue components", + "description": "vue组件库封装", + "main": "lib/jvuewhell.umd.min.js", + "scripts": { + "serve": "set port=8081 && vue-cli-service serve", + "build": "vue-cli-service build", + "lint": "eslint --ext .js,.vue packages", + "lib": "vue-cli-service build --target lib --name jvuewhell --dest lib packages/index.js" + }, + "lint-staged": { + "*.{ts,tsx,js,vue}": "eslint --fix" + }, + "dependencies": { + "@typescript-eslint/eslint-plugin": "^4.28.2", + "@typescript-eslint/parser": "^4.28.2", + "eslint": "^3.19.0", + "eslint-config-standard": "^10.2.1", + "eslint-friendly-formatter": "^3.0.0", + "eslint-loader": "^1.7.1", + "eslint-plugin-html": "^3.0.0", + "eslint-plugin-import": "^2.7.0", + "eslint-plugin-node": "^5.2.0", + "eslint-plugin-promise": "^3.4.0", + "eslint-plugin-standard": "^3.0.1", + "babel-eslint": "^7.1.1", + "core-js": "^2.6.5", + "element-ui": "^2.15.3", + "highlight.js": "^11.3.1", + "node-sass": "^4.14.1", + "sass": "^1.37.5", + "scss": "^0.2.4", + "scss-loader": "0.0.1", + "vue": "^2.6.10", + "vue-codemirror": "^4.0.6", + "vue-highlightjs": "^1.3.3", + "vue-router": "^3.5.2" + }, + "devDependencies": { + "eslint-config-standard": "12.0.0", + "sass-loader": "^8.0.2", + "style-loader": "^3.2.1", + "vue-style-loader": "^4.1.3", + "@vue/cli-plugin-babel": "^3.8.0", + "@vue/cli-service": "^3.8.0", + "vue-template-compiler": "^2.6.10", + "compression-webpack-plugin": "^8.0.1" + } } diff --git a/JYeontuComponentWarehouse/packages/JCalendar/index.js b/JYeontuComponentWarehouse/packages/JCalendar/index.js index 7a0f0ea3d0c481b4d2e0b058c9ec144f8e49399f..394151b8bcd4c528c797d91f2d08276c5fc88100 100644 --- a/JYeontuComponentWarehouse/packages/JCalendar/index.js +++ b/JYeontuComponentWarehouse/packages/JCalendar/index.js @@ -1,5 +1,5 @@ -import JCalendar from './src/JCalendar.vue'; +import JCalendar from "./src/JCalendar.vue"; -JCalendar.install = Vue => Vue.component(JCalendar.name, JCalendar);//注册组件 +JCalendar.install = Vue => Vue.component(JCalendar.name, JCalendar); //注册组件 -export default JCalendar \ No newline at end of file +export default JCalendar; diff --git a/JYeontuComponentWarehouse/packages/JCalendar/src/JCalendar.vue b/JYeontuComponentWarehouse/packages/JCalendar/src/JCalendar.vue index 66eee9382d570a46ed36bf24daad7150e2bd3782..e7a1d30e575dbeb51846c7399c7c73ef4dfa6c5b 100644 --- a/JYeontuComponentWarehouse/packages/JCalendar/src/JCalendar.vue +++ b/JYeontuComponentWarehouse/packages/JCalendar/src/JCalendar.vue @@ -1,295 +1,313 @@ diff --git a/JYeontuComponentWarehouse/packages/JCanvasBroad/index.js b/JYeontuComponentWarehouse/packages/JCanvasBroad/index.js index fd197d0aec220e7bb14ee8bddaaf491ffdbc0de7..32cee7ad40552b4b8c143056e708cf72c80d7487 100644 --- a/JYeontuComponentWarehouse/packages/JCanvasBroad/index.js +++ b/JYeontuComponentWarehouse/packages/JCanvasBroad/index.js @@ -1,5 +1,5 @@ -import JCanvasBroad from './src/JCanvasBroad.vue'; +import JCanvasBroad from "./src/JCanvasBroad.vue"; -JCanvasBroad.install = Vue => Vue.component(JCanvasBroad.name, JCanvasBroad);//注册组件 +JCanvasBroad.install = Vue => Vue.component(JCanvasBroad.name, JCanvasBroad); //注册组件 -export default JCanvasBroad \ No newline at end of file +export default JCanvasBroad; diff --git a/JYeontuComponentWarehouse/packages/JCanvasBroad/src/JCanvasBroad.vue b/JYeontuComponentWarehouse/packages/JCanvasBroad/src/JCanvasBroad.vue index 5d80e62145276660c0ed5e30ed1a06061f97911f..fd3aa704888a30c52e815f56b192f886f14f4068 100644 --- a/JYeontuComponentWarehouse/packages/JCanvasBroad/src/JCanvasBroad.vue +++ b/JYeontuComponentWarehouse/packages/JCanvasBroad/src/JCanvasBroad.vue @@ -1,304 +1,344 @@ diff --git a/JYeontuComponentWarehouse/packages/JCodeHeightLight/index.js b/JYeontuComponentWarehouse/packages/JCodeHeightLight/index.js index 9263964fea478382994aa6abc4481e09fcbb8e90..826eb7ee26f21543f4490ace7efdc3e4b8a74f1b 100644 --- a/JYeontuComponentWarehouse/packages/JCodeHeightLight/index.js +++ b/JYeontuComponentWarehouse/packages/JCodeHeightLight/index.js @@ -1,5 +1,6 @@ -import JCodeHeightLight from './src/JCodeHeightLight.vue'; +import JCodeHeightLight from "./src/JCodeHeightLight.vue"; -JCodeHeightLight.install = Vue => Vue.component(JCodeHeightLight.name, JCodeHeightLight);//注册组件 +JCodeHeightLight.install = Vue => + Vue.component(JCodeHeightLight.name, JCodeHeightLight); //注册组件 -export default JCodeHeightLight \ No newline at end of file +export default JCodeHeightLight; diff --git a/JYeontuComponentWarehouse/packages/JCodeHeightLight/src/JCodeHeightLight.vue b/JYeontuComponentWarehouse/packages/JCodeHeightLight/src/JCodeHeightLight.vue index 23aafe0a93b6bb28726715381f2f0db6c808ebc7..56e647a46f05b19af0b1e5ddc8be54bddb5b5793 100644 --- a/JYeontuComponentWarehouse/packages/JCodeHeightLight/src/JCodeHeightLight.vue +++ b/JYeontuComponentWarehouse/packages/JCodeHeightLight/src/JCodeHeightLight.vue @@ -1,296 +1,408 @@ - diff --git a/JYeontuComponentWarehouse/packages/JDialog/index.js b/JYeontuComponentWarehouse/packages/JDialog/index.js index d2df2dd7db3dd2b3e9d22008a2d396bc882d4db5..4c07f70c1323d4129e72bfec4c92e27d7783b5e3 100644 --- a/JYeontuComponentWarehouse/packages/JDialog/index.js +++ b/JYeontuComponentWarehouse/packages/JDialog/index.js @@ -1,5 +1,5 @@ -import JDialog from './src/JDialog.vue'; +import JDialog from "./src/JDialog.vue"; -JDialog.install = Vue => Vue.component(JDialog.name, JDialog);//注册组件 +JDialog.install = Vue => Vue.component(JDialog.name, JDialog); //注册组件 -export default JDialog \ No newline at end of file +export default JDialog; diff --git a/JYeontuComponentWarehouse/packages/JDialog/src/JDialog.vue b/JYeontuComponentWarehouse/packages/JDialog/src/JDialog.vue index 457f8c8e0276488db9c91acce9d6de46f7b337a0..49f6368c4764bfe1a560ffaabba3bee3fe0e72b8 100644 --- a/JYeontuComponentWarehouse/packages/JDialog/src/JDialog.vue +++ b/JYeontuComponentWarehouse/packages/JDialog/src/JDialog.vue @@ -1,50 +1,182 @@ diff --git a/JYeontuComponentWarehouse/packages/JElectronicNumber/index.js b/JYeontuComponentWarehouse/packages/JElectronicNumber/index.js index a86743f60e64228ae3bae77775a071bc534dd642..101aa45545ff47d722f9526986d81f4ec44efb4e 100644 --- a/JYeontuComponentWarehouse/packages/JElectronicNumber/index.js +++ b/JYeontuComponentWarehouse/packages/JElectronicNumber/index.js @@ -1,5 +1,6 @@ -import JElectronicNumber from './src/JElectronicNumber.vue'; +import JElectronicNumber from "./src/JElectronicNumber.vue"; -JElectronicNumber.install = Vue => Vue.component(JElectronicNumber.name, JElectronicNumber);//注册组件 +JElectronicNumber.install = Vue => + Vue.component(JElectronicNumber.name, JElectronicNumber); //注册组件 -export default JElectronicNumber \ No newline at end of file +export default JElectronicNumber; diff --git a/JYeontuComponentWarehouse/packages/JElectronicNumber/src/JElectronicNumber.vue b/JYeontuComponentWarehouse/packages/JElectronicNumber/src/JElectronicNumber.vue index 00e9f09e4ac99c3a0a7a7796cded1ff60946f110..e433376222233ed1a414320f525ae6f6b73dc61d 100644 --- a/JYeontuComponentWarehouse/packages/JElectronicNumber/src/JElectronicNumber.vue +++ b/JYeontuComponentWarehouse/packages/JElectronicNumber/src/JElectronicNumber.vue @@ -1,266 +1,264 @@ diff --git a/JYeontuComponentWarehouse/packages/JFloatDiv/index.js b/JYeontuComponentWarehouse/packages/JFloatDiv/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c0a80d994fa9b51cb6f59e572d9104e81311cef2 --- /dev/null +++ b/JYeontuComponentWarehouse/packages/JFloatDiv/index.js @@ -0,0 +1,5 @@ +import JFloatDiv from "./src/JFloatDiv.vue"; + +JFloatDiv.install = Vue => Vue.component(JFloatDiv.name, JFloatDiv); //注册组件 + +export default JFloatDiv; diff --git a/JYeontuComponentWarehouse/packages/JFloatDiv/src/JFloatDiv.vue b/JYeontuComponentWarehouse/packages/JFloatDiv/src/JFloatDiv.vue new file mode 100644 index 0000000000000000000000000000000000000000..d52d79b0b7546f733340471867b361bd441e0224 --- /dev/null +++ b/JYeontuComponentWarehouse/packages/JFloatDiv/src/JFloatDiv.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/JYeontuComponentWarehouse/packages/JFlowChart/index.js b/JYeontuComponentWarehouse/packages/JFlowChart/index.js index b99454fc40c5028872790267dde243b935b77043..8cbc727d4cd8190ac1e78fd5b216ddaeff9c0a1e 100644 --- a/JYeontuComponentWarehouse/packages/JFlowChart/index.js +++ b/JYeontuComponentWarehouse/packages/JFlowChart/index.js @@ -1,5 +1,5 @@ -import JFlowChart from './src/JFlowChart.vue'; +import JFlowChart from "./src/JFlowChart.vue"; -JFlowChart.install = Vue => Vue.component(JFlowChart.name, JFlowChart);//注册组件 +JFlowChart.install = Vue => Vue.component(JFlowChart.name, JFlowChart); //注册组件 -export default JFlowChart \ No newline at end of file +export default JFlowChart; diff --git a/JYeontuComponentWarehouse/packages/JFlowChart/src/JFlowChart.vue b/JYeontuComponentWarehouse/packages/JFlowChart/src/JFlowChart.vue index 4c125cd4190f06970099d30224706e02fc85803e..ce90e193d346aaa2b03e467afad9f22effcf3a34 100644 --- a/JYeontuComponentWarehouse/packages/JFlowChart/src/JFlowChart.vue +++ b/JYeontuComponentWarehouse/packages/JFlowChart/src/JFlowChart.vue @@ -1,372 +1,407 @@ diff --git a/JYeontuComponentWarehouse/packages/JHoverBtn/index.js b/JYeontuComponentWarehouse/packages/JHoverBtn/index.js index 1e501c17bbb42e4de454b34a1e08dbe80833f3d9..8cc843adb8e69904a8ae8bb4d0edc9ac8d897448 100644 --- a/JYeontuComponentWarehouse/packages/JHoverBtn/index.js +++ b/JYeontuComponentWarehouse/packages/JHoverBtn/index.js @@ -1,5 +1,5 @@ -import JHoverBtn from './src/JHoverBtn.vue'; +import JHoverBtn from "./src/JHoverBtn.vue"; -JHoverBtn.install = Vue => Vue.component(JHoverBtn.name, JHoverBtn);//注册组件 +JHoverBtn.install = Vue => Vue.component(JHoverBtn.name, JHoverBtn); //注册组件 -export default JHoverBtn \ No newline at end of file +export default JHoverBtn; diff --git a/JYeontuComponentWarehouse/packages/JHoverBtn/src/JHoverBtn.vue b/JYeontuComponentWarehouse/packages/JHoverBtn/src/JHoverBtn.vue index 9276fa450eb012bde62fc7ee592958f13575830f..3a7d92cc735618dc2d3b6e4f08be7835f4429a4c 100644 --- a/JYeontuComponentWarehouse/packages/JHoverBtn/src/JHoverBtn.vue +++ b/JYeontuComponentWarehouse/packages/JHoverBtn/src/JHoverBtn.vue @@ -1,154 +1,159 @@ diff --git a/JYeontuComponentWarehouse/packages/JNumRolling/index.js b/JYeontuComponentWarehouse/packages/JNumRolling/index.js index ff6b0fdb1d0a16b4fcee3b80189fecf028474415..a52042fedadf858ddb5052bdfbd054f5028bd5d6 100644 --- a/JYeontuComponentWarehouse/packages/JNumRolling/index.js +++ b/JYeontuComponentWarehouse/packages/JNumRolling/index.js @@ -1,5 +1,5 @@ -import JNumRolling from './src/JNumRolling.vue'; +import JNumRolling from "./src/JNumRolling.vue"; -JNumRolling.install = Vue => Vue.component(JNumRolling.name, JNumRolling);//注册组件 +JNumRolling.install = Vue => Vue.component(JNumRolling.name, JNumRolling); //注册组件 -export default JNumRolling \ No newline at end of file +export default JNumRolling; diff --git a/JYeontuComponentWarehouse/packages/JNumRolling/src/JNumRolling.vue b/JYeontuComponentWarehouse/packages/JNumRolling/src/JNumRolling.vue index 9e196479a80ca9c5d175e5893145a222a460c3dd..8ac9f4f36e9e16598a55f955697d32d79a25322a 100644 --- a/JYeontuComponentWarehouse/packages/JNumRolling/src/JNumRolling.vue +++ b/JYeontuComponentWarehouse/packages/JNumRolling/src/JNumRolling.vue @@ -1,215 +1,227 @@ diff --git a/JYeontuComponentWarehouse/packages/JSteps/index.js b/JYeontuComponentWarehouse/packages/JSteps/index.js index 15969b78302483f0ffa43695728ce082cf86f345..881768bd7db098543c675325c6c0ef1265283fa3 100644 --- a/JYeontuComponentWarehouse/packages/JSteps/index.js +++ b/JYeontuComponentWarehouse/packages/JSteps/index.js @@ -1,5 +1,5 @@ -import JSteps from './src/JSteps.vue'; +import JSteps from "./src/JSteps.vue"; -JSteps.install = Vue => Vue.component(JSteps.name, JSteps);//注册组件 +JSteps.install = Vue => Vue.component(JSteps.name, JSteps); //注册组件 -export default JSteps \ No newline at end of file +export default JSteps; diff --git a/JYeontuComponentWarehouse/packages/JSteps/src/JSteps.vue b/JYeontuComponentWarehouse/packages/JSteps/src/JSteps.vue index 67132f67fc9719e38711ebe318781863b188ea92..f6ba27909ca3d892c8ca3932e18dc5a97f13e970 100644 --- a/JYeontuComponentWarehouse/packages/JSteps/src/JSteps.vue +++ b/JYeontuComponentWarehouse/packages/JSteps/src/JSteps.vue @@ -1,45 +1,276 @@ diff --git a/JYeontuComponentWarehouse/packages/JTable/index.js b/JYeontuComponentWarehouse/packages/JTable/index.js index 73ec90d6d566e126fd33dccea5a95ee223276e1c..1056082e8ed0152f506ba9ae7933c5a8e18f3963 100644 --- a/JYeontuComponentWarehouse/packages/JTable/index.js +++ b/JYeontuComponentWarehouse/packages/JTable/index.js @@ -1,5 +1,5 @@ -import JTable from './src/JTable.vue'; +import JTable from "./src/JTable.vue"; -JTable.install = Vue => Vue.component(JTable.name, JTable);//注册组件 +JTable.install = Vue => Vue.component(JTable.name, JTable); //注册组件 -export default JTable \ No newline at end of file +export default JTable; diff --git a/JYeontuComponentWarehouse/packages/JTable/src/JTable.vue b/JYeontuComponentWarehouse/packages/JTable/src/JTable.vue index a899beeaf1945959ceb5ce9607306b7b45f895ce..9be0673890fe7af9c140fc7c2f11b970c2f8b0cb 100644 --- a/JYeontuComponentWarehouse/packages/JTable/src/JTable.vue +++ b/JYeontuComponentWarehouse/packages/JTable/src/JTable.vue @@ -1,197 +1,188 @@ diff --git a/JYeontuComponentWarehouse/packages/JTable/src/JTr.vue b/JYeontuComponentWarehouse/packages/JTable/src/JTr.vue new file mode 100644 index 0000000000000000000000000000000000000000..42cfe116b2efcd049c6d681c90e5c332263fadf7 --- /dev/null +++ b/JYeontuComponentWarehouse/packages/JTable/src/JTr.vue @@ -0,0 +1,265 @@ + + + + + diff --git a/JYeontuComponentWarehouse/packages/index.js b/JYeontuComponentWarehouse/packages/index.js index 2bfecd1a99785b510f6d85958a46824be45f4a84..3efe24d5c8518389ca829b4d0cda4adb093799e8 100644 --- a/JYeontuComponentWarehouse/packages/index.js +++ b/JYeontuComponentWarehouse/packages/index.js @@ -1,42 +1,46 @@ -import JCalendar from './JCalendar' -import JTable from './JTable' -import JCanvasBroad from './JCanvasBroad' -import JCodeHeightLight from './JCodeHeightLight' -import JFlowChart from './JFlowChart' -import JElectronicNumber from './JElectronicNumber' -import JNumRolling from './JNumRolling' -import JDialog from './JDialog' -import JHoverBtn from './JHoverBtn' +import JCalendar from "./JCalendar"; +import JTable from "./JTable"; +import JCanvasBroad from "./JCanvasBroad"; +import JCodeHeightLight from "./JCodeHeightLight"; +import JFlowChart from "./JFlowChart"; +import JElectronicNumber from "./JElectronicNumber"; +import JNumRolling from "./JNumRolling"; +import JDialog from "./JDialog"; +import JHoverBtn from "./JHoverBtn"; +import JFloatDiv from "./JFloatDiv"; +import JSteps from "./JSteps"; // 存储组件列表 const components = [ - JCalendar, - JTable, - JCanvasBroad, - JCodeHeightLight, - JFlowChart, - JElectronicNumber, - JNumRolling, - JDialog, - JHoverBtn -] + JCalendar, + JTable, + JCanvasBroad, + JCodeHeightLight, + JFlowChart, + JElectronicNumber, + JNumRolling, + JDialog, + JHoverBtn, + JFloatDiv, + JSteps +]; // 定义 install 方法,接收 Vue 作为参数。如果使用 use 注册插件,则所有的组件都将被注册 -const install = function (Vue) { - // 判断是否安装 - if (install.installed) return - // 遍历注册全局组件 - components.map(component => Vue.component(component.name, component)) -} +const install = function(Vue) { + // 判断是否安装 + if (install.installed) return; + // 遍历注册全局组件 + components.map(component => Vue.component(component.name, component)); +}; // 判断是否是直接引入文件 -if (typeof window !== 'undefined' && window.Vue) { - install(window.Vue) +if (typeof window !== "undefined" && window.Vue) { + install(window.Vue); } export default { - // 导出的对象必须具有 install,才能被 Vue.use() 方法安装 - install, - // 以下是具体的组件列表 - ...components -} \ No newline at end of file + // 导出的对象必须具有 install,才能被 Vue.use() 方法安装 + install, + // 以下是具体的组件列表 + ...components +}; diff --git a/JYeontuComponentWarehouse/packages/pagesTools/JTabBar.vue b/JYeontuComponentWarehouse/packages/pagesTools/JTabBar.vue index 395cb83506e0347d84382660f28e245f5137798e..87e6affd2022900f421fbd17101f1b9ac66af166 100644 --- a/JYeontuComponentWarehouse/packages/pagesTools/JTabBar.vue +++ b/JYeontuComponentWarehouse/packages/pagesTools/JTabBar.vue @@ -1,89 +1,86 @@ diff --git a/JYeontuComponentWarehouse/packages/pagesTools/splitHorizontal.vue b/JYeontuComponentWarehouse/packages/pagesTools/splitHorizontal.vue index 91b87d46a001dbe10c318e197970774e56b8274a..0d0ed2a655c0827bec490cb6a77289501721c95f 100644 --- a/JYeontuComponentWarehouse/packages/pagesTools/splitHorizontal.vue +++ b/JYeontuComponentWarehouse/packages/pagesTools/splitHorizontal.vue @@ -1,59 +1,58 @@ - + diff --git a/JYeontuComponentWarehouse/packages/utils/dateTool.js b/JYeontuComponentWarehouse/packages/utils/dateTool.js index f9604725b5784fd89b91c4763ca7fdfd33b9cfa5..6a94f70293495c9480487f90090c697431a90e84 100644 --- a/JYeontuComponentWarehouse/packages/utils/dateTool.js +++ b/JYeontuComponentWarehouse/packages/utils/dateTool.js @@ -4,21 +4,21 @@ * @return {Boolean} */ -export const isLeap = function (year) { - if ((year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0)) { - return true +export const isLeap = function(year) { + if ((year % 4 === 0 && year % 100 !== 0) || year % 400 === 0) { + return true; } - return false + return false; }; /** * 获取星期 * @param {string} date 日期 * @return {string} 星期 */ -export const getWeek = function (date) { - let Stamp = new Date(date) +export const getWeek = function(date) { + let Stamp = new Date(date); // return weeks[Stamp.getDay()]; - let weeks = ['日','一','二','三','四','五','六']; + let weeks = ["日", "一", "二", "三", "四", "五", "六"]; return weeks[Stamp.getDay()]; }; /** @@ -27,30 +27,30 @@ export const getWeek = function (date) { * @param {string} month 月份 * @return {number} 月份天数 */ -export const getMonthDays = function (year, month) { - month = parseInt(month) - 1 - if (month < 0 || month > 11) return '' - let months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] +export const getMonthDays = function(year, month) { + month = parseInt(month) - 1; + if (month < 0 || month > 11) return ""; + let months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; if (isLeap(year)) { - months[1] = 29 + months[1] = 29; } - return months[month] + return months[month]; }; /** * 数字补零 * @param {string} str * @return {string} */ -export const zero = function (str) { - str = parseInt(str) - return str > 9 ? str : '0' + str +export const zero = function(str) { + str = parseInt(str); + return str > 9 ? str : "0" + str; }; /** * 获取今天日期 * @param {string} str 日期格式 * @return {string} 格式化日期 */ -export const getToday = function (str = "yyyy-mm-dd") { +export const getToday = function(str = "yyyy-mm-dd") { const date = new Date(); const year = date.getFullYear(), month = zero(date.getMonth() + 1), @@ -58,54 +58,65 @@ export const getToday = function (str = "yyyy-mm-dd") { hour = zero(date.getHours()), minute = zero(date.getMinutes()), second = zero(date.getSeconds()); - let res = ''; - switch (str){ + let res = ""; + switch (str) { case "yyyy-mm-dd": - res = year + '-' + month + '-' + day; + res = year + "-" + month + "-" + day; break; case "mm-dd-yyyy": - res = month + '-' + day + '-' + year; + res = month + "-" + day + "-" + year; break; case "yyyy-mm-dd hh:MM:ss": - res = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; + res = + year + + "-" + + month + + "-" + + day + + " " + + hour + + ":" + + minute + + ":" + + second; break; case "hh:MM:ss": - res = hour + ':' + minute + ':' + second; + res = hour + ":" + minute + ":" + second; break; case "yyyy": res = year; break; - case "mm": - res = month; - break; - case "dd": - res = day; - break; - case "hh": - res = hour; - break; - case "MM": - res = minute; - break; - case "ss": - res = second; - break; + case "mm": + res = month; + break; + case "dd": + res = day; + break; + case "hh": + res = hour; + break; + case "MM": + res = minute; + break; + case "ss": + res = second; + break; case "mm-dd": - res = month + '-' + day; + res = month + "-" + day; break; default: - res = '参数错误'; + res = "参数错误"; break; } return res; -} +}; /** * 将时间按照所传入的时间格式进行转换 * @param {string} value 日期 * @param {string} formatStr 日期格式 * @return {string} 格式化日期 */ -export const dateFormat = function (value,formatStr = 'yyyy-mm-dd') { +export const dateFormat = function(value, formatStr = "yyyy-mm-dd") { const date = new Date(value); const year = date.getFullYear(), month = zero(date.getMonth() + 1), @@ -113,115 +124,128 @@ export const dateFormat = function (value,formatStr = 'yyyy-mm-dd') { hour = zero(date.getHours()), minute = zero(date.getMinutes()), second = zero(date.getSeconds()); - let res = ''; - switch (formatStr){ + let res = ""; + switch (formatStr) { case "yyyy-mm-dd": - res = year + '-' + month + '-' + day; + res = year + "-" + month + "-" + day; break; case "mm-dd-yyyy": - res = month + '-' + day + '-' + year; + res = month + "-" + day + "-" + year; break; case "yyyy-mm-dd hh:MM:ss": - res = year + '-' + month + '-' + day + ' ' + hour + ':' + minute + ':' + second; + res = + year + + "-" + + month + + "-" + + day + + " " + + hour + + ":" + + minute + + ":" + + second; break; case "hh:MM:ss": - res = hour + ':' + minute + ':' + second; + res = hour + ":" + minute + ":" + second; break; case "yyyy": res = year; - break; - case "mm": - res = month; - break; - case "dd": - res = day; - break; - case "hh": - res = hour; - break; - case "MM": - res = minute; - break; - case "ss": - res = second; + break; + case "mm": + res = month; + break; + case "dd": + res = day; + break; + case "hh": + res = hour; + break; + case "MM": + res = minute; + break; + case "ss": + res = second; break; case "mm-dd": - res = month + '-' + day; + res = month + "-" + day; break; default: - res = '参数错误'; + res = "参数错误"; break; } return res; -} +}; /** * 获取上一天日期 * @param {string} str 当前日期 * @return {string} 上一天日期 */ -export const getYesterday = function (str) { - let date = str.split('-'); +export const getYesterday = function(str) { + let date = str.split("-"); let year = parseInt(date[0]), month = parseInt(date[1]), day = parseInt(date[2]); - if(month > 12 || month < 1 || day > getMonthDays(year,month)) return '日期不合法'; + if (month > 12 || month < 1 || day > getMonthDays(year, month)) + return "日期不合法"; day -= 1; - if(day > 0){ - return year + '-' + zero(month) + '-' + zero(day); + if (day > 0) { + return year + "-" + zero(month) + "-" + zero(day); } month -= 1; - if(month > 0){ - return year + '-' + zero(month) + '-' + getMonthDays(year,month); + if (month > 0) { + return year + "-" + zero(month) + "-" + getMonthDays(year, month); } year -= 1; - return year + '-' + 12 + '-' + getMonthDays(year,12); + return year + "-" + 12 + "-" + getMonthDays(year, 12); }; /** * 获取下一天日期 * @param {string} str 当前日期 * @return {string} 下一天日期 */ -export const getTomorrow = function (str){ - let date = str.split('-'); +export const getTomorrow = function(str) { + let date = str.split("-"); let year = parseInt(date[0]), month = parseInt(date[1]), day = parseInt(date[2]); - if(month > 12 || month < 1 || day > getMonthDays(year,month)) return '日期不合法'; + if (month > 12 || month < 1 || day > getMonthDays(year, month)) + return "日期不合法"; day += 1; - if(day <= getMonthDays(year,month)){ - return year + '-' + zero(month) + '-' + zero(day); + if (day <= getMonthDays(year, month)) { + return year + "-" + zero(month) + "-" + zero(day); } month += 1; - if(month < 13){ - return year + '-' + zero(month) + '-' + '01'; + if (month < 13) { + return year + "-" + zero(month) + "-" + "01"; } year += 1; - return year + '-' + '01' + '-' + '01'; -} + return year + "-" + "01" + "-" + "01"; +}; /** * 获取前n天日期 * @param {string} n 当前日期 * @return {string} 前n天日期 */ -export const beforeDay = function (date,n){ - if(date.split('-').length < 3) return '日期格式错误'; - let res = dateFormat(date); - n = parseInt(n); - while(n--){ - res = getYesterday(res); - } - return res; -} +export const beforeDay = function(date, n) { + if (date.split("-").length < 3) return "日期格式错误"; + let res = dateFormat(date); + n = parseInt(n); + while (n--) { + res = getYesterday(res); + } + return res; +}; /** * 获取后n天日期 * @param {string} n 当前日期 * @return {string} 后n天日期 */ -export const afterDay = function (date,n){ - if(date.split('-').length < 3) return '日期格式错误'; - let res = dateFormat(date); - while(n--){ - res = getTomorrow(res); - } - return res; -} +export const afterDay = function(date, n) { + if (date.split("-").length < 3) return "日期格式错误"; + let res = dateFormat(date); + while (n--) { + res = getTomorrow(res); + } + return res; +}; diff --git a/JYeontuComponentWarehouse/packages/utils/numsFormat.js b/JYeontuComponentWarehouse/packages/utils/numsFormat.js index 515a2af7b2fcfe6ff2ae5b8d633639029378d7d2..3da1c0099c3c4d2c4cf6444d8eafd590f3a48821 100644 --- a/JYeontuComponentWarehouse/packages/utils/numsFormat.js +++ b/JYeontuComponentWarehouse/packages/utils/numsFormat.js @@ -4,12 +4,45 @@ * @return {string} 英文表示 **/ export const numberToWords = function(num) { - const singles = ["", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine"]; - const teens = ["Ten", "Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eighteen", "Nineteen"]; - const tens = ["", "Ten", "Twenty", "Thirty", "Forty", "Fifty", "Sixty", "Seventy", "Eighty", "Ninety"]; + const singles = [ + "", + "One", + "Two", + "Three", + "Four", + "Five", + "Six", + "Seven", + "Eight", + "Nine" + ]; + const teens = [ + "Ten", + "Eleven", + "Twelve", + "Thirteen", + "Fourteen", + "Fifteen", + "Sixteen", + "Seventeen", + "Eighteen", + "Nineteen" + ]; + const tens = [ + "", + "Ten", + "Twenty", + "Thirty", + "Forty", + "Fifty", + "Sixty", + "Seventy", + "Eighty", + "Ninety" + ]; const thousands = ["", "Thousand", "Million", "Billion"]; - const toEnglish = (num) => { + const toEnglish = num => { const curr = []; const hundred = Math.floor(num / 100); num %= 100; @@ -26,21 +59,25 @@ export const numberToWords = function(num) { } else if (num >= 10) { curr.push(teens[num - 10] + " "); } - return curr.join(''); - } + return curr.join(""); + }; if (num === 0) { return "Zero"; } const sb = []; - for (let i = 3, unit = 1000000000; i >= 0; i--, unit = Math.floor(unit / 1000)) { + for ( + let i = 3, unit = 1000000000; + i >= 0; + i--, unit = Math.floor(unit / 1000) + ) { const curNum = Math.floor(num / unit); if (curNum !== 0) { num -= curNum * unit; sb.push(toEnglish(curNum) + thousands[i] + " "); } } - return sb.join('').trim(); + return sb.join("").trim(); }; /** * @description 数字转换为大写中文表示 @@ -48,164 +85,179 @@ export const numberToWords = function(num) { * @return {string} 大写中文表示 **/ export const numberToChineseWords = money => { - // 汉字的数字 - const cnNums = ['零', '壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖'] - // 基本单位 - const cnIntRadice = ['', '拾', '佰', '仟'] - // 对应整数部分扩展单位 - const cnIntUnits = ['', '万', '亿', '兆'] - // 对应小数部分单位 - const cnDecUnits = ['角', '分', '毫', '厘'] - // 整数金额时后面跟的字符 - const cnInteger = '整' - // 整型完以后的单位 - const cnIntLast = '元' - // 最大处理的数字 - const maxNum = 9999999999999999.99 - // 金额整数部分 - let integerNum - // 金额小数部分 - let decimalNum - // 输出的中文金额字符串 - let chineseStr = '' - // 分离金额后用的数组,预定义 - let parts - if (money === '') { return '' } - money = parseFloat(money) - if (money >= maxNum) { - // 超出最大处理数字 - return '' - } - if (money === 0) { - chineseStr = cnNums[0] + cnIntLast + cnInteger - return chineseStr - } - // 转换为字符串 - money = money.toString() - if (money.indexOf('.') === -1) { - integerNum = money - decimalNum = '' - } else { - parts = money.split('.') - integerNum = parts[0] - decimalNum = parts[1].substr(0, 4) - } - console.log(integerNum, decimalNum) - // 获取整型部分转换 - if (parseInt(integerNum, 10) > 0) { - var zeroCount = 0 - var IntLen = integerNum.length - for (var i = 0; i < IntLen; i++) { - let n = integerNum.substr(i, 1) - let p = IntLen - i - 1 - let q = p / 4 - let m = p % 4 - if (n === '0') { - zeroCount++ - } else { - if (zeroCount > 0) { - chineseStr += cnNums[0] + // 汉字的数字 + const cnNums = ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"]; + // 基本单位 + const cnIntRadice = ["", "拾", "佰", "仟"]; + // 对应整数部分扩展单位 + const cnIntUnits = ["", "万", "亿", "兆"]; + // 对应小数部分单位 + const cnDecUnits = ["角", "分", "毫", "厘"]; + // 整数金额时后面跟的字符 + const cnInteger = "整"; + // 整型完以后的单位 + const cnIntLast = "元"; + // 最大处理的数字 + const maxNum = 9999999999999999.99; + // 金额整数部分 + let integerNum; + // 金额小数部分 + let decimalNum; + // 输出的中文金额字符串 + let chineseStr = ""; + // 分离金额后用的数组,预定义 + let parts; + if (money === "") { + return ""; + } + money = parseFloat(money); + if (money >= maxNum) { + // 超出最大处理数字 + return ""; + } + if (money === 0) { + chineseStr = cnNums[0] + cnIntLast + cnInteger; + return chineseStr; + } + // 转换为字符串 + money = money.toString(); + if (money.indexOf(".") === -1) { + integerNum = money; + decimalNum = ""; + } else { + parts = money.split("."); + integerNum = parts[0]; + decimalNum = parts[1].substr(0, 4); + } + console.log(integerNum, decimalNum); + // 获取整型部分转换 + if (parseInt(integerNum, 10) > 0) { + var zeroCount = 0; + var IntLen = integerNum.length; + for (var i = 0; i < IntLen; i++) { + let n = integerNum.substr(i, 1); + let p = IntLen - i - 1; + let q = p / 4; + let m = p % 4; + if (n === "0") { + zeroCount++; + } else { + if (zeroCount > 0) { + chineseStr += cnNums[0]; + } + // 归零 + zeroCount = 0; + chineseStr += cnNums[parseInt(n)] + cnIntRadice[m]; + } + if (m === 0 && zeroCount < 4) { + chineseStr += cnIntUnits[q]; + } + } + chineseStr += cnIntLast; + } + // 小数部分 + if (decimalNum !== "") { + var decLen = decimalNum.length; + for (let i = 0; i < decLen; i++) { + let n = decimalNum.substr(i, 1); + if (n !== "0") { + chineseStr += cnNums[Number(n)] + cnDecUnits[i]; + } } - // 归零 - zeroCount = 0 - chineseStr += cnNums[parseInt(n)] + cnIntRadice[m] - } - if (m === 0 && zeroCount < 4) { - chineseStr += cnIntUnits[q] - } } - chineseStr += cnIntLast - } - // 小数部分 - if (decimalNum !== '') { - var decLen = decimalNum.length - for (let i = 0; i < decLen; i++) { - let n = decimalNum.substr(i, 1) - if (n !== '0') { - chineseStr += cnNums[Number(n)] + cnDecUnits[i] - } + if (chineseStr === "") { + chineseStr += cnNums[0] + cnIntLast + cnInteger; + } else if (decimalNum === "") { + chineseStr += cnInteger; } - } - if (chineseStr === '') { - chineseStr += cnNums[0] + cnIntLast + cnInteger - } else if (decimalNum === '') { - chineseStr += cnInteger - } - return chineseStr + return chineseStr; }; /** * @description 数字千分位分隔 * @param {String} num 数字 - * @param {String} separator 分隔符,默认为英文逗号',' - * @return {String} 千分位分隔后的数字 + * @param {String} separator 分隔符,默认为英文逗号',' + * @return {String} 千分位分隔后的数字 **/ - export const numberToSplitWords = function(num,separator=','){ - num = num.toString(); - if(num.length < 3) return num; - let flag = ''; - if(num[0] == '-'){ - flag = '-'; - num = num.substr(1); - } - num = num.split('.'); - const num1 = num[0],len1 = num[0].length; - let res = ''; - for(let i = 0; i < num1.length; i++){ - if(i != 0 && i % 3 == 0){ - res = separator + res; - } - res = num1[len1 - i - 1] + res; - } - if(num.length > 1){ - res += '.'; - const num2 = num[1],len2 = num[1].length; - for(let i = 0; i < num2.length; i++){ - if(i != 0 && i % 3 == 0){ - res += separator; - } - res += num2[i]; - } - } - return flag + res; - }; - - /** - * @description 整数转罗马数字 - * @param {number} num 整数 - * @return {string} 罗马数字 - */ +export const numberToSplitWords = function(num, separator = ",") { + num = num.toString(); + if (num.length < 3) return num; + let flag = ""; + if (num[0] == "-") { + flag = "-"; + num = num.substr(1); + } + num = num.split("."); + const num1 = num[0], + len1 = num[0].length; + let res = ""; + for (let i = 0; i < num1.length; i++) { + if (i != 0 && i % 3 == 0) { + res = separator + res; + } + res = num1[len1 - i - 1] + res; + } + if (num.length > 1) { + res += "."; + const num2 = num[1], + len2 = num[1].length; + for (let i = 0; i < num2.length; i++) { + if (i != 0 && i % 3 == 0) { + res += separator; + } + res += num2[i]; + } + } + return flag + res; +}; + +/** + * @description 整数转罗马数字 + * @param {number} num 整数 + * @return {string} 罗马数字 + */ export const intToRoman = function(num) { - //num > 0 && num <= 3999 - if(num <= 0 || num > 3999) return '数字范围应该为1~3999'; + //num > 0 && num <= 3999 + if (num <= 0 || num > 3999) return "数字范围应该为1~3999"; const thousands = ["", "M", "MM", "MMM"]; - const hundreds = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM"]; - const tens = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]; - const ones = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; + const hundreds = [ + "", + "C", + "CC", + "CCC", + "CD", + "D", + "DC", + "DCC", + "DCCC", + "CM" + ]; + const tens = ["", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC"]; + const ones = ["", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"]; const roman = []; - num = parseInt(num); + num = parseInt(num); roman.push(thousands[Math.floor(num / 1000)]); - roman.push(hundreds[Math.floor(num % 1000 / 100)]); - roman.push(tens[Math.floor(num % 100 / 10)]); + roman.push(hundreds[Math.floor((num % 1000) / 100)]); + roman.push(tens[Math.floor((num % 100) / 10)]); roman.push(ones[num % 10]); - return roman.join(''); + return roman.join(""); }; /** - * @description 罗马数字转整数 + * @description 罗马数字转整数 * @param {string} s 罗马数字 * @return {number} 整数 */ export const romanToInt = function(s) { const symbolValues = new Map(); - symbolValues.set('I', 1); - symbolValues.set('V', 5); - symbolValues.set('X', 10); - symbolValues.set('L', 50); - symbolValues.set('C', 100); - symbolValues.set('D', 500); - symbolValues.set('M', 1000); + symbolValues.set("I", 1); + symbolValues.set("V", 5); + symbolValues.set("X", 10); + symbolValues.set("L", 50); + symbolValues.set("C", 100); + symbolValues.set("D", 500); + symbolValues.set("M", 1000); let ans = 0; const n = s.length; for (let i = 0; i < n; ++i) { diff --git a/JYeontuComponentWarehouse/packages/utils/strTool.js b/JYeontuComponentWarehouse/packages/utils/strTool.js index 20a4e2416759b52953e4af8ef8efbe0624db0aaf..0cedd52827fd2b22002b498f0ae0fc78810b614c 100644 --- a/JYeontuComponentWarehouse/packages/utils/strTool.js +++ b/JYeontuComponentWarehouse/packages/utils/strTool.js @@ -3,45 +3,45 @@ * @param {String} str 需要转换的字符串 * @return {String} 小驼峰形式字符串 **/ -export const _toLittleCamel = function(str){ - let newStr = str.split('-'); - if(newStr.length <= 1) return str; - let res = newStr[0]; - for(let i = 1; i < newStr.length; i++){ - res += newStr[i][0].toUpperCase() + newStr[i].substr(1); - } - return res; -} +export const _toLittleCamel = function(str) { + let newStr = str.split("-"); + if (newStr.length <= 1) return str; + let res = newStr[0]; + for (let i = 1; i < newStr.length; i++) { + res += newStr[i][0].toUpperCase() + newStr[i].substr(1); + } + return res; +}; /** * @description '-'连接命名转换成大驼峰命名 * @param {String} str 需要转换的字符串 * @return {String} 大驼峰形式字符串 **/ -export const _toBigCamel = function(str){ - let newStr = str.split('-'); - if(newStr.length <= 1) return str; - let res = ''; - for(let i = 0; i < newStr.length; i++){ - res += newStr[i][0].toUpperCase() + newStr[i].substr(1); - } - return res; -} +export const _toBigCamel = function(str) { + let newStr = str.split("-"); + if (newStr.length <= 1) return str; + let res = ""; + for (let i = 0; i < newStr.length; i++) { + res += newStr[i][0].toUpperCase() + newStr[i].substr(1); + } + return res; +}; /** * @description 驼峰命名转换成'-'连接命名 * @param {String} str 需要转换的字符串 * @return {String} '-'连接形式字符串 **/ -export const camelTo_ = function(str){ - let res = ''; - for(let i = 0; i < str.length; i++){ - if(str[i] >= 'A' && str[i] <= 'Z'){ - if(i == 0) res += str[i].toLowerCase(); - else{ - res += '-' + str[i].toLowerCase(); - } - }else{ - res += str[i]; - } - } - return res; -} +export const camelTo_ = function(str) { + let res = ""; + for (let i = 0; i < str.length; i++) { + if (str[i] >= "A" && str[i] <= "Z") { + if (i == 0) res += str[i].toLowerCase(); + else { + res += "-" + str[i].toLowerCase(); + } + } else { + res += str[i]; + } + } + return res; +}; diff --git a/JYeontuComponentWarehouse/postcss.config.js b/JYeontuComponentWarehouse/postcss.config.js index 961986e2b11eeebe1d4ddabdf2e6c85e2a2562e0..59ea1f32094b6d9ed78dfe48ca13e6428f479e6d 100644 --- a/JYeontuComponentWarehouse/postcss.config.js +++ b/JYeontuComponentWarehouse/postcss.config.js @@ -1,5 +1,5 @@ module.exports = { - plugins: { - autoprefixer: {} - } -} + plugins: { + autoprefixer: {} + } +}; diff --git a/JYeontuComponentWarehouse/public/index.html b/JYeontuComponentWarehouse/public/index.html index 344254ab191dc3cfe58dfe7f8f759e7388a26afb..5dcd8dbabcb475cd4ba3801cb9c1f542729a852f 100644 --- a/JYeontuComponentWarehouse/public/index.html +++ b/JYeontuComponentWarehouse/public/index.html @@ -1,17 +1,20 @@ - - - - - - JYeontu组件库 - - - -
- - + + + + + + JYeontu组件库 + + + +
+ + diff --git a/JYeontuComponentWarehouse/vue.config.js b/JYeontuComponentWarehouse/vue.config.js index 70eaa6a489ca388489fd04c1589aa800ec451828..bc14587022f9047d125cfab90a797f5c7ea370b6 100644 --- a/JYeontuComponentWarehouse/vue.config.js +++ b/JYeontuComponentWarehouse/vue.config.js @@ -1,54 +1,53 @@ -const CompressionPlugin = require('compression-webpack-plugin') +const CompressionPlugin = require("compression-webpack-plugin"); -let path = require('path') -function resolve (dir) { - return path.join(__dirname, dir) +let path = require("path"); +function resolve(dir) { + return path.join(__dirname, dir); } module.exports = { - productionSourceMap: false, // 不生成map文件,解决项目上线首次打开加载慢的问题 - publicPath: './', // 解决打包文件,访问空白的文件路径问题 + productionSourceMap: false, // 不生成map文件,解决项目上线首次打开加载慢的问题 + publicPath: "./", // 解决打包文件,访问空白的文件路径问题 - pages: { - // lintOnSave: false, - index: { - entry: "examples/main.js", - template: "public/index.html", - filename: "index.html" - } - }, - - chainWebpack: config => { - // 用@设置自定义地址 - // 配置快捷路径,@为路径名字,resolve是原路径地址 - config.resolve.alias - .set('@', resolve('examples')) // key,value自行定义,比如.set('@@', resolve('src/components')) - .set('~', resolve('packages')) + pages: { + // lintOnSave: false, + index: { + entry: "examples/main.js", + template: "public/index.html", + filename: "index.html" + } + }, + + chainWebpack: config => { + // 用@设置自定义地址 + // 配置快捷路径,@为路径名字,resolve是原路径地址 + config.resolve.alias + .set("@", resolve("examples")) // key,value自行定义,比如.set('@@', resolve('src/components')) + .set("~", resolve("packages")); - // gzip 压缩配置 - if (process.env.NODE_ENV === 'production') { - return { + // gzip 压缩配置 + if (process.env.NODE_ENV === "production") { + return { // gzip会对js、css文件进行压缩处理(压缩效果比较明显,能压缩至原来的1/3左右);对于图片进行压缩问题,对于png,jpg,jpeg没有压缩效果,对于svg,ico文件以及bmp文件压缩效果达到50%,在productionGzipExtensions: ['js', 'css','svg']设置需要进行压缩的什么格式的文件。 - plugins: [ - new CompressionPlugin({ - test: /\.(js|css)(\?.*)?$/i, // 需要压缩的文件正则 - threshold: 10240, // 对超过10k的数据进行压缩 - deleteOriginalAssets: false // 是否删除原文件 - }) - ] - } + plugins: [ + new CompressionPlugin({ + test: /\.(js|css)(\?.*)?$/i, // 需要压缩的文件正则 + threshold: 10240, // 对超过10k的数据进行压缩 + deleteOriginalAssets: false // 是否删除原文件 + }) + ] + }; + } } - }, // cdn使用了cdn 可以忽略打包第三方库 - // configureWebpack: { - // externals: { - // 'vue': 'Vue', - // 'vue-router': 'VueRouter', - // 'vuex': 'Vuex', - // // 'axios': 'axios', - // 'element-ui': 'ELEMENT', - // // 'moment': 'moment', - // 'echarts': 'echarts' - // } - // } - -} + // configureWebpack: { + // externals: { + // 'vue': 'Vue', + // 'vue-router': 'VueRouter', + // 'vuex': 'Vuex', + // // 'axios': 'axios', + // 'element-ui': 'ELEMENT', + // // 'moment': 'moment', + // 'echarts': 'echarts' + // } + // } +}; diff --git a/README.md b/README.md index f8b7af76de51b000e0c2911fbd059d36b58708ab..bc2cc27576a04f41e7ef1f04cad36e3e8dd8e802 100644 --- a/README.md +++ b/README.md @@ -4,25 +4,52 @@ 日常开发组件/工具库 vue组件 + js函数工具 -#### 软件架构 +封装一些有趣(实用的小组件),后续会不断迭代优化。 +#### 安装教程 +##### 本地启动项目 -#### 安装教程 -1. git clone +1. git clone https://gitee.com/zheng_yongtao/jyeontu-component-warehouse.git 2. npm install 3. npm run serve -#### 效果预览 -[预览地址](http://jyeontu.xyz/JYeontuComponents/#/homePage) +##### 项目引入 + +###### npm 安装 + +推荐使用 npm 的方式安装,它能更好地和 webpack 打包工具配合使用。 + +```shell +npm i @jyeontu/jvuewheel -S +``` -[预览地址(备用)](http://120.79.163.94/JYeontuComponents/#/flowChartView) +###### main.js引入 -#### 使用说明 +引入后便可以在项目中直接使用 -1. JYeontuCalendar(日历组件):[https://blog.csdn.net/Twinkle_sone/article/details/120465663](http://https://blog.csdn.net/Twinkle_sone/article/details/120465663) -2. electronicNumber(电子屏数字组件):[https://blog.csdn.net/Twinkle_sone/article/details/120582994](https://blog.csdn.net/Twinkle_sone/article/details/120582994) -3. xxxx +```shell +//引入组件库 +import jvuewheel from '@jyeontu/jvuewheel' +//引入样式 +import '@jyeontu/jvuewheel/lib/jvuewhell.css' +Vue.use(jvuewheel); +``` + +#### 效果预览 +[预览地址(使用文档)](http://120.79.163.94/JYeontuComponents/#/homePage) + +#### 相关说明 +组件文档:[http://120.79.163.94/JYeontuComponents/#/homePage](http://120.79.163.94/JYeontuComponents/#/homePage) +1. 日历组件(JCalendar):[https://blog.csdn.net/Twinkle_sone/article/details/120465663](http://https://blog.csdn.net/Twinkle_sone/article/details/120465663) +2. 电子屏数字(JElectronicNumber):[https://blog.csdn.net/Twinkle_sone/article/details/120582994](https://blog.csdn.net/Twinkle_sone/article/details/120582994) +3. 流程图组件(JFlowchart) +4. 表格组件(JTable) +5. 代码高亮组件(JCodeHeightLight) +6. canvas画板组件(JCanvasBroad):[https://blog.csdn.net/Twinkle_sone/article/details/121476250](https://blog.csdn.net/Twinkle_sone/article/details/121476250) +7. 数字滚动变化效果(JNumRolling):[https://blog.csdn.net/Twinkle_sone/article/details/121541104](https://blog.csdn.net/Twinkle_sone/article/details/121541104) +8. 对话弹窗(JDialog) +9. 可拖拽悬浮按钮(JHoverBtn):[https://blog.csdn.net/Twinkle_sone/article/details/121658022](https://blog.csdn.net/Twinkle_sone/article/details/121658022) #### 参与贡献 @@ -31,12 +58,12 @@ vue组件 + js函数工具 3. 提交代码 4. 新建 Pull Request +#### 联系 + +CSDN:[https://blog.csdn.net/Twinkle_sone](https://blog.csdn.net/Twinkle_sone) + +Gitee:[https://gitee.com/zheng_yongtao](https://gitee.com/zheng_yongtao) -#### 特技 +GitHub:[https://github.com/yongtaozheng](https://github.com/yongtaozheng) -1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md -2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com) -3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目 -4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目 -5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help) -6. Gitee 封面人物是一档用来展示 Gitee 会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/) +掘金:[https://juejin.cn/user/440244290727294](https://juejin.cn/user/440244290727294)