From a0c66bcdd4a95862ca1cf158391cf2a07545ff33 Mon Sep 17 00:00:00 2001 From: JYeontu Date: Wed, 16 Mar 2022 12:02:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?toolTip=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examples/config/router.json | 12 + .../views/componentShowViews/JToolTipView.vue | 225 ++++++++++++++++++ .../packages/JToolTip/index.js | 5 + .../packages/JToolTip/src/JToolTip.vue | 119 +++++++++ JYeontuComponentWarehouse/packages/index.js | 4 +- .../packages/utils/strTool.js | 15 ++ 6 files changed, 379 insertions(+), 1 deletion(-) create mode 100644 JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue create mode 100644 JYeontuComponentWarehouse/packages/JToolTip/index.js create mode 100644 JYeontuComponentWarehouse/packages/JToolTip/src/JToolTip.vue diff --git a/JYeontuComponentWarehouse/examples/config/router.json b/JYeontuComponentWarehouse/examples/config/router.json index a107059..c640270 100644 --- a/JYeontuComponentWarehouse/examples/config/router.json +++ b/JYeontuComponentWarehouse/examples/config/router.json @@ -219,6 +219,18 @@ "component": "views/componentShowViews/JCommentView.vue", "children": [] }, + { + "id": 21, + "name": "JToolTipView", + "path": "/JToolTipView", + "label": "悬浮提示", + "selected": false, + "icon": "icon-ciyuntu", + "open": false, + "hide": false, + "component": "views/componentShowViews/JToolTipView.vue", + "children": [] + }, { "id": 8, "name": "utilsTools", diff --git a/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue b/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue new file mode 100644 index 0000000..c182717 --- /dev/null +++ b/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue @@ -0,0 +1,225 @@ + + + diff --git a/JYeontuComponentWarehouse/packages/JToolTip/index.js b/JYeontuComponentWarehouse/packages/JToolTip/index.js new file mode 100644 index 0000000..43323f7 --- /dev/null +++ b/JYeontuComponentWarehouse/packages/JToolTip/index.js @@ -0,0 +1,5 @@ +import JToolTip from "./src/JToolTip.vue"; + +JToolTip.install = Vue => Vue.component(JToolTip.name, JToolTip); //注册组件 + +export default JToolTip; diff --git a/JYeontuComponentWarehouse/packages/JToolTip/src/JToolTip.vue b/JYeontuComponentWarehouse/packages/JToolTip/src/JToolTip.vue new file mode 100644 index 0000000..422e366 --- /dev/null +++ b/JYeontuComponentWarehouse/packages/JToolTip/src/JToolTip.vue @@ -0,0 +1,119 @@ + + + + + diff --git a/JYeontuComponentWarehouse/packages/index.js b/JYeontuComponentWarehouse/packages/index.js index 1cfc419..035d84a 100644 --- a/JYeontuComponentWarehouse/packages/index.js +++ b/JYeontuComponentWarehouse/packages/index.js @@ -21,6 +21,7 @@ import JTagList from "./JTagList"; import JToast from "./JToast"; import JWordCloud from "./JWordCloud"; import JComment from "./JComment"; +import JToolTip from "./JToolTip"; // 存储组件列表 const components = [ @@ -39,7 +40,8 @@ const components = [ JTagList, JToast, JWordCloud, - JComment + JComment, + JToolTip // Toast ]; diff --git a/JYeontuComponentWarehouse/packages/utils/strTool.js b/JYeontuComponentWarehouse/packages/utils/strTool.js index 0cedd52..dd1ce78 100644 --- a/JYeontuComponentWarehouse/packages/utils/strTool.js +++ b/JYeontuComponentWarehouse/packages/utils/strTool.js @@ -45,3 +45,18 @@ export const camelTo_ = function(str) { } return res; }; +export const getRandomLetter = (size = 8) => { + let res = ""; + for (let i = 0; i < size; i++) { + let ind = Math.floor(Math.random() * 26); + res += String.fromCharCode(ind + 65); + } + return res; +}; +export const getUId = (letterNums = 8, numberNums = 6) => { + const uId = + getRandomLetter(letterNums) + + "-" + + Math.ceil(Math.random() * Math.pow(10, numberNums)); + return uId; +}; -- Gitee From 0769e9b8d6c2d5c6f5d24e49695449003e22a9a7 Mon Sep 17 00:00:00 2001 From: JYeontu Date: Wed, 16 Mar 2022 15:21:43 +0800 Subject: [PATCH 2/2] =?UTF-8?q?toolTip=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JYeontuComponentWarehouse/examples/App.vue | 2 +- JYeontuComponentWarehouse/examples/main.js | 7 + .../views/componentShowViews/JToolTipView.vue | 184 +++++++++--------- JYeontuComponentWarehouse/public/index.html | 5 + 4 files changed, 108 insertions(+), 90 deletions(-) diff --git a/JYeontuComponentWarehouse/examples/App.vue b/JYeontuComponentWarehouse/examples/App.vue index ccbb8ab..273ddc1 100644 --- a/JYeontuComponentWarehouse/examples/App.vue +++ b/JYeontuComponentWarehouse/examples/App.vue @@ -134,7 +134,7 @@ body { font-family: "Avenir", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; - text-align: center; + // text-align: center; color: #2c3e50; /*margin-top: 60px;*/ width: 100vw; diff --git a/JYeontuComponentWarehouse/examples/main.js b/JYeontuComponentWarehouse/examples/main.js index 212c120..c2b7ae3 100644 --- a/JYeontuComponentWarehouse/examples/main.js +++ b/JYeontuComponentWarehouse/examples/main.js @@ -18,6 +18,13 @@ Vue.use(ElementUI); Vue.config.devtools = true; Vue.config.productionTip = false; +Vue.directive("highlight", function(el) { + let blocks = el.querySelectorAll("pre code"); + blocks.forEach(block => { + hljs.highlightBlock(block); + }); +}); + new Vue({ router, render: h => h(App) diff --git a/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue b/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue index c182717..ca5a3b0 100644 --- a/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue +++ b/JYeontuComponentWarehouse/examples/views/componentShowViews/JToolTipView.vue @@ -29,17 +29,16 @@ @@ -105,95 +104,102 @@ export default { sort: false // 是否支持排序 } ], - tableData: [ + tableData: [] + }; + }, + created() { + this.initTableData(); + this.initCodeContent(); + }, + mounted() {}, + methods: { + initCodeContent() { + this.code = ` + +export default { + data() { + return { + textStyle: { + borderBottom: "1px dotted skyblue", + fontSize: "large", + color: "skyblue" + }, + toolTipStyle: { + backgroundColor: "grey", + color: "skyblue", + width: "100px" + }, + } + } +} + `; + }, + initTableData() { + this.tableData = [ { - parameter: "bgColor", - field: "按钮背景颜色", + parameter: "tipText", + field: "提示内容", type: "String", - describe: "默认为deepskyblue" - }, - { - parameter: "autoHide", - field: "贴边隐藏", - type: "Boolean", - describe: "按钮移动到左右两侧会自动缩进两边,默认为true" - }, - { - parameter: "clickDis", - field: "判断是否点击事件距离(px)", - type: "Number", - describe: "移动距离小于该值则为点击事件,默认为10" - }, - { - parameter: "showWidth", - field: "贴边隐藏后露出宽度(px)", - type: "Number", - describe: "数字保留小数点,默认为15" - }, - { - parameter: "width", - field: "按钮宽高(px)", - type: "Number", - describe: "默认为80" - }, - { - parameter: "radius", - field: "是否圆角", - type: "Boolean", - describe: "默认为true" + describe: "" }, { - parameter: "btnStyle", - field: "自定义样式", + parameter: "textStyle", + field: "文字样式", type: "Object", - describe: "键值对形式,支持驼峰命名和-命名" - }, - { - parameter: "text", - field: "按钮显示文字", - type: "String", - describe: "默认为'悬浮按钮'" + describe: "设置文字样式,如下划线样式", + children: { + type: "text", + text: '{"border-bottom": "1px dotted black"}' + } }, { - parameter: "zIndex", - field: "按钮层级", - type: "Number", - describe: "默认为999" + parameter: "toolTipStyle", + field: "提示框内容样式", + type: "Object", + describe: "具体配置如下", + children: { + title: this.tableTitle, + data: [ + { + parameter: "backgroundColor", + field: "提示框背景颜色", + type: "String", + describe: "默认为#062b45" + }, + { + parameter: "color", + field: "提示框字体颜色", + type: "String", + describe: "默认为#fff" + }, + { + parameter: "width", + field: "提示框宽度", + type: "String", + describe: "默认为100px" + } + ] + } } - ] - }; - }, - created() { - this.code = ` - - - - export default { - data(){ - return { - btnStyle:{ - "fontSize":'small', - "top":'60vh', - "left":'90vw' - }, - } - }, - methods:{ - hoverBtnClick(){ - alert('触发点击事件'); - } - } - } - `; - }, - mounted() {}, - methods: { - hoverBtnClick() { - alert("触发点击事件"); + ]; } } }; diff --git a/JYeontuComponentWarehouse/public/index.html b/JYeontuComponentWarehouse/public/index.html index 5dcd8db..f373b6f 100644 --- a/JYeontuComponentWarehouse/public/index.html +++ b/JYeontuComponentWarehouse/public/index.html @@ -5,6 +5,11 @@ + + JYeontu组件库 -- Gitee