From da24338833f580b8efbcb64976e678250c11f851 Mon Sep 17 00:00:00 2001 From: wangshz Date: Tue, 10 Aug 2021 15:58:12 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E3=80=90ID1131459=E3=80=91=20=E5=9F=8E?= =?UTF-8?q?=E5=B8=82=E5=9F=BA=E7=A1=80=E7=BB=84=E4=BB=B6=EF=BC=8C=E5=8F=97?= =?UTF-8?q?=E9=99=90=E5=9F=8E=E5=B8=82=E5=A2=9E=E5=8A=A0=E6=90=9C=E7=B4=A2?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/city-picker/cityPicker.vue | 10 ++++ src/city-picker/city-picker.js | 20 +++++++- src/index.js | 72 +++++++---------------------- 3 files changed, 45 insertions(+), 57 deletions(-) diff --git a/examples/city-picker/cityPicker.vue b/examples/city-picker/cityPicker.vue index a7db6b4..249d019 100644 --- a/examples/city-picker/cityPicker.vue +++ b/examples/city-picker/cityPicker.vue @@ -6,6 +6,7 @@
  • 国际城市
  • 全部城市
  • 受限城市
  • +
  • 受限城市搜索
  • 显示历史记录
  • 不显示热门城市
  • 可搜索
  • @@ -40,11 +41,19 @@ v-model="picker3" > + { if (install.installed) return; - components.map((component) => { + components.map(component => { if (component.name && typeof component !== "function") { const eventName = hyphenate(component.name); if (EVENTS[eventName] && typeof EVENTS[eventName] === "function") { - Vue.component(component.name, EVENTS[eventName]()); + Vue.component(component.name, EVENTS[eventName]()); } else { - Vue.component(component.name, component); + Vue.component(component.name, component); } } else if (component.install) { Vue.use(component); @@ -106,24 +68,24 @@ if (typeof window !== "undefined" && window.Vue) { install(window.Vue); } const config = (options = {}) => { - Object.keys(options).forEach((componentName) => { - const ca = hyphenate(componentName); - components.forEach((component) => { - if (ca === component.name) { - if (component.callback && typeof component.callback === "function") { - EVENTS[ca] = () => { - return component.callback(options[componentName]); - }; - } - } - }); + Object.keys(options).forEach(componentName => { + const ca = hyphenate(componentName); + components.forEach((component) => { + if (ca === component.name) { + if (component.callback && (typeof component.callback === "function")) { + EVENTS[ca] = () => { + return component.callback(options[componentName]); + } + } + } + }); }); }; export { install, version, config }; export default { install, version, - config, + config }; export { ActionSheet as YnActionSheet }; export { AnimationList as YnAnimationList }; From 7d375dd16898279b955674d4b7c0e90c9e552046 Mon Sep 17 00:00:00 2001 From: wangshz Date: Wed, 11 Aug 2021 14:09:24 +0800 Subject: [PATCH 2/7] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E7=A1=AE=E5=AE=9A=E6=8C=89=E9=92=AE=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=87=A0=E6=99=9A=E7=9A=84demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/calendar/calendar.vue | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/examples/calendar/calendar.vue b/examples/calendar/calendar.vue index 88a7c29..c0fa6ae 100644 --- a/examples/calendar/calendar.vue +++ b/examples/calendar/calendar.vue @@ -138,6 +138,8 @@ v-model="calendar5" v-on:getDate="handleOnGetDate5" :showConfirmButton="true" + :confirmText="confirmText" + @changeDate="changeDate" > Date: Wed, 11 Aug 2021 14:11:58 +0800 Subject: [PATCH 3/7] =?UTF-8?q?feat:=20double=E6=97=A5=E6=9C=9F=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E4=B8=8B=EF=BC=8CfromDate=E6=88=96=E8=80=85toDate?= =?UTF-8?q?=E7=A1=AE=E5=AE=9A=EF=BC=88=E9=BB=98=E8=AE=A4=E5=80=BC=E6=88=96?= =?UTF-8?q?=E8=80=85=E7=94=A8=E6=88=B7=E7=82=B9=E5=87=BB=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=EF=BC=89=E6=97=B6=EF=BC=8C=E8=A7=A6=E5=8F=91changeDate?= =?UTF-8?q?=E4=BA=8B=E4=BB=B6=EF=BC=8C=E5=B9=B6=E8=BF=94=E5=9B=9E=E6=97=A5?= =?UTF-8?q?=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/calendar/calendar.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calendar/calendar.js b/src/calendar/calendar.js index 034f340..257bf9e 100644 --- a/src/calendar/calendar.js +++ b/src/calendar/calendar.js @@ -209,6 +209,7 @@ export default defineComponent({ this.changedNode = { [date.key]: date }; } } + this.$emit("changeDate", { fromDate: this.fromDate, toDate: this.toDate }); }, handleOnConfirm() { if (this.confirmButtonClassName !== "active") { @@ -350,6 +351,7 @@ export default defineComponent({ } this.fromDate = startNode; this.toDate = endNode; + this.$emit("changeDate", { fromDate: this.fromDate, toDate: this.toDate }); } else { const node = this.getDefaultNodeFromProps("defaultDate", [ "single-mode", From 9ea52040ff7747308a15df9d38281aa41fa4f376 Mon Sep 17 00:00:00 2001 From: wangshz Date: Mon, 23 Aug 2021 14:06:13 +0800 Subject: [PATCH 4/7] =?UTF-8?q?fix:=20=E6=97=A5=E6=9C=9F=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=A5=E6=9C=9F=E5=90=8E=E5=86=8D=C3=97?= =?UTF-8?q?=E6=8E=89=EF=BC=8C=E5=86=8D=E6=AC=A1=E8=BF=9B=E5=85=A5=E6=97=A5?= =?UTF-8?q?=E5=8E=86=E5=BC=B9=E6=A1=86=E6=97=B6=E9=80=89=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=85=A5=E7=A6=BB=E6=97=A5=E6=9C=9F=E6=B2=A1=E6=9C=89=E5=88=B7?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/calendar/calendar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calendar/calendar.js b/src/calendar/calendar.js index 257bf9e..ee9f147 100644 --- a/src/calendar/calendar.js +++ b/src/calendar/calendar.js @@ -109,7 +109,7 @@ export default defineComponent({ }; }, watch: { - mode: "highLightDefault", + value: "highLightDefault", }, methods: { handleClick(date) { From 0499d210b9678146f0e39d62f0f9746fbae7c3ba Mon Sep 17 00:00:00 2001 From: wangshz Date: Mon, 23 Aug 2021 14:12:58 +0800 Subject: [PATCH 5/7] =?UTF-8?q?fix:=E6=97=A5=E5=8E=86=E5=BC=B9=E6=A1=86?= =?UTF-8?q?=E9=80=89=E4=B8=AD=E6=97=A5=E6=9C=9F=E5=90=8E=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/calendar/calendar.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/calendar/calendar.js b/src/calendar/calendar.js index ee9f147..dcf45ea 100644 --- a/src/calendar/calendar.js +++ b/src/calendar/calendar.js @@ -203,6 +203,7 @@ export default defineComponent({ this.confirmButtonClassName = "disable"; this.toDate = null; drop(date.className, "during-active"); + drop(date.className, ["active", "end"]); push(date.className, ["start", "active"]); this.setDateValue(date, "mark", this.fromDateMark); this.fromDate = date; From 0ae7f6c176b8fe95361fb9854afc1d75feecdf1f Mon Sep 17 00:00:00 2001 From: wangshz Date: Mon, 30 Aug 2021 13:39:25 +0800 Subject: [PATCH 6/7] =?UTF-8?q?feat:=20=E6=9C=89=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=88=99=E9=AB=98=E4=BA=AE=E7=9A=84demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/dropdown-menu/dropdownMenu.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/examples/dropdown-menu/dropdownMenu.vue b/examples/dropdown-menu/dropdownMenu.vue index 1981e32..8d25d68 100644 --- a/examples/dropdown-menu/dropdownMenu.vue +++ b/examples/dropdown-menu/dropdownMenu.vue @@ -2,7 +2,7 @@

    yn-dropdown-menu

    - + +
    这里面是自定义内容 + 设置筛选 + 取消筛选 关闭
    @@ -152,6 +162,9 @@ export default { changeData3(e) { this.$refs.closeAble.check(e); }, + changeData4(e) { + this.$refs.menuItem.setIsFiltered(e); + }, switchTo(i) { this.$refs.switchTo.switchTab(i, true); } From b21758c509c1df0f5de3a7a8fdcf108d30fcc44b Mon Sep 17 00:00:00 2001 From: wangshz Date: Mon, 30 Aug 2021 13:39:45 +0800 Subject: [PATCH 7/7] =?UTF-8?q?feat:=20=E6=9C=89=E7=AD=9B=E9=80=89?= =?UTF-8?q?=E5=88=99=E9=AB=98=E4=BA=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dropdown-menu-item/dropdown-menu-item.js | 20 ++++++++++++++++++++ src/dropdown-menu/dropdown-menu.js | 15 ++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/src/dropdown-menu-item/dropdown-menu-item.js b/src/dropdown-menu-item/dropdown-menu-item.js index f9b012d..c9a5aa0 100644 --- a/src/dropdown-menu-item/dropdown-menu-item.js +++ b/src/dropdown-menu-item/dropdown-menu-item.js @@ -68,6 +68,7 @@ export default defineComponent({ }, data() { return { + isFiltered: false, show: false, menuStatus: false, bodyOverflow: null, @@ -142,6 +143,23 @@ export default defineComponent({ return this.checked; } }, + setIsFiltered(flag) { + this.isFiltered = flag; + }, + getIsFiltered() { + if (this.hasOptions()) { + if (this.slots().length > 0) { + // 自定义内容 + return this.isFiltered; + } else { + if (this.currentSelected > -1) { + return true; + } + } + } else { + return this.checked; + } + }, check(selected = false, options = {}) { if (this.hasOptions()) { if ((selected && !this.show) || (!selected && this.show)) { @@ -183,6 +201,8 @@ export default defineComponent({ this.show = false; }, closeTab() { + const { slideUp } = this.parent; + slideUp && typeof slideUp === "function" && slideUp(); this.close(); this.$parent.closeTab(); }, diff --git a/src/dropdown-menu/dropdown-menu.js b/src/dropdown-menu/dropdown-menu.js index 1d70be1..7762ada 100644 --- a/src/dropdown-menu/dropdown-menu.js +++ b/src/dropdown-menu/dropdown-menu.js @@ -18,6 +18,10 @@ export default defineComponent({ mixins: [slotsMixins, provideMixins()], components: { Flex, FlexItem, Iconfont }, props: { + highLightByFiltered: { + type: Boolean, + default: false + }, direction: { type: String, default: "down", @@ -139,7 +143,7 @@ export default defineComponent({ // const active = this.currentTab === key; let active = false; if (showDirectionIcon) { - active = this.currentTab === key; + active = this.currentTab === key && this.currentTabStauts; } else { if (fixed) { active = this.tabs[key]; @@ -147,6 +151,15 @@ export default defineComponent({ active = this.currentTab === key && this.currentTabStauts; } } + if (this.highLightByFiltered && item.componentInstance) { + active = active || item.componentInstance.getIsFiltered(); + } else if (this.highLightByFiltered && !item.componentInstance) { + const { defaultSelectedIndex = -1, options = [] } = item.componentOptions.propsData; + if (defaultSelectedIndex > -1 && options.length > 0 ) { + // 带默认选中项的下拉筛选 + active = true; + } + } return h( genComponentName("flex-item"), {