1 line
26 KiB
Plaintext
1 line
26 KiB
Plaintext
{"version":3,"sources":["webpack:///E:/云商会/云商会/tuniao-ui/components/tn-select/tn-select.vue?4fb5","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-select/tn-select.vue?5144","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-select/tn-select.vue?b361","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-select/tn-select.vue?183e","uni-app:///tuniao-ui/components/tn-select/tn-select.vue","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-select/tn-select.vue?aadf","webpack:///E:/云商会/云商会/tuniao-ui/components/tn-select/tn-select.vue?1e70"],"names":["name","props","value","type","default","mode","list","valueName","labelName","childName","defaultValue","title","cancelText","cancelColor","confirmText","confirmColor","maskCloseable","safeAreaInsetBottom","zIndex","searchShow","searchPlaceholder","computed","elZIndex","data","moving","defaultSelector","columnData","selectValue","lastSelectIndex","columnNum","watch","handler","immediate","methods","searchInput","console","search","searchResult","result","pickStart","pickEnd","init","setDefaultSelector","setColumnNum","column","num","setColumnData","setSelectValue","tmp","label","columnChange","columnIndex","close","getResult"],"mappings":";;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAkI;AAClI;AAC6D;AACL;AACsC;;;AAG9F;AAC+L;AAC/L,gBAAgB,wMAAU;AAC1B,EAAE,+EAAM;AACR,EAAE,gGAAM;AACR,EAAE,yGAAe;AACjB;AACA;AACA;AACA;AACA;AACA,EAAE,oGAAU;AACZ;AACA;;AAEA;AACe,gF;;;;;;;;;;;;ACvBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;ACAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA,aAAa,4QAEN;AACP,KAAK;AACL;AACA,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,GAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACjCA;AAAA;AAAA;AAAA;AAAquB,CAAgB,0vBAAG,EAAC,C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBC4CzvB;EACAA;EACAC;IACAC;MACAC;MACAC;IACA;IACA;IACA;IACAC;MACAF;MACAC;IACA;IACA;IACAE;MACAH;MACAC;QACA;MACA;IACA;IACA;IACAG;MACAJ;MACAC;IACA;IACA;IACAI;MACAL;MACAC;IACA;IACA;IACAK;MACAN;MACAC;IACA;IACA;IACAM;MACAP;MACAC;QACA;MACA;IACA;IACA;IACAO;MACAR;MACAC;IACA;IACA;IACAQ;MACAT;MACAC;IACA;IACA;IACAS;MACAV;MACAC;IACA;IACA;IACAU;MACAX;MACAC;IACA;IACA;IACAW;MACAZ;MACAC;IACA;IACA;IACAY;MACAb;MACAC;IACA;IACA;IACAa;MACAd;MACAC;IACA;IACA;IACAc;MACAf;MACAC;IACA;IACA;IACAe;MACAhB;MACAC;IACA;IACA;IACAgB;MACAjB;MACAC;IACA;EACA;EACAiB;IACAC;MACA;IACA;EACA;EACAC;IACA;MACA;MACAC;MACA;MACAC;MACA;MACAC;MACA;MACAC;MACA;MACAC;MACA;MACAC;IAEA;EACA;EACAC;IACA;IACA5B;MACA6B;QAAA;QACA;UAAA;QAAA;MACA;MACAC;IACA;EACA;EACAC;IACA;IACAC;MACAC;MACA;IACA;IACA;IACAC;MACAD;MACA;IACA;IACA;IACAE;MAAA;MACA;MACA;MACA;QAAA;MAAA;MACA;QACAC;MACA;MACA;MACA;MACA;MACA;QACA;MACA;IACA;IAEA;IACAC;MAEA;IAEA;IACA;IACAC;MAEA;IAEA;IACAC;MACA;MACA;MACA;MACA;IACA;IACA;IACAC;MACA;MACA,oGACAb;MACA;IACA;IACA;IACAc;MACA;MACA;MACA;MAAA,KACA;MACA;MAAA,KACA;QACA;QACA;QACA;QACA;UACAC,qDACAC;QACA;QACA;MACA;IACA;IACA;IACAC;MACA;MACA;MACA;QACA;QACA;QACA;QACA;UACA;UACA;YACAvB;YACAqB;UACA;YACA;YACArB;YACAqB;UACA;QACA;MACA;QACArB;MACA;QACAA;MACA;MACA;IACA;IACA;IACAwB;MACA;MACA;QACAC;QACA;UACA9C;UACA+C;QACA;QACA;QACA;QACA;MACA;MACA;IACA;IACA;IACAC;MAAA;MACA;MACA;MAEA;MACA;QACA;QACA;UACA;QACA;QACA;QACA;QACA;QACA;UACA,0FACAzC,UACA;UACA;QACA;QACA;QACA;QACA0C;UACA;UACA;YACAjD;YACA+C;UACA;UACA;UACA;QACA;QACA;MACA;QACA;QACA;UACA/C;UACA+C;QACA;QACA;QACA;MACA;QACAE;UACA;UACA;YACAjD;YACA+C;UACA;UACA;UACA;QACA;MACA;IACA;IACAG;MACA;IACA;IACAC;MAAA;MAEA;MAEA;MACA;IACA;EACA;AACA;AAAA,4B;;;;;;;;;;;;ACtVA;AAAA;AAAA;AAAA;AAAg5C,CAAgB,62CAAG,EAAC,C;;;;;;;;;;;ACAp6C;AACA,OAAO,KAAU,EAAE,kBAKd","file":"tuniao-ui/components/tn-select/tn-select.js","sourcesContent":["import { render, staticRenderFns, recyclableRender, components } from \"./tn-select.vue?vue&type=template&id=a65b9b48&scoped=true&\"\nvar renderjs\nimport script from \"./tn-select.vue?vue&type=script&lang=js&\"\nexport * from \"./tn-select.vue?vue&type=script&lang=js&\"\nimport style0 from \"./tn-select.vue?vue&type=style&index=0&id=a65b9b48&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\runtime\\\\componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"a65b9b48\",\n null,\n false,\n components,\n renderjs\n)\n\ncomponent.options.__file = \"tuniao-ui/components/tn-select/tn-select.vue\"\nexport default component.exports","export * from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\templateLoader.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--17-0!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\template.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-uni-app-loader\\\\page-meta.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-select.vue?vue&type=template&id=a65b9b48&scoped=true&\"","var components\ntry {\n components = {\n tnPopup: function () {\n return import(\n /* webpackChunkName: \"tuniao-ui/components/tn-popup/tn-popup\" */ \"@/tuniao-ui/components/tn-popup/tn-popup.vue\"\n )\n },\n }\n} catch (e) {\n if (\n e.message.indexOf(\"Cannot find module\") !== -1 &&\n e.message.indexOf(\".vue\") !== -1\n ) {\n console.error(e.message)\n console.error(\"1. 排查组件名称拼写是否正确\")\n console.error(\n \"2. 排查组件是否符合 easycom 规范,文档:https://uniapp.dcloud.net.cn/collocation/pages?id=easycom\"\n )\n console.error(\n \"3. 若组件不符合 easycom 规范,需手动引入,并在 components 中注册该组件\"\n )\n } else {\n throw e\n }\n}\nvar render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n}\nvar recyclableRender = false\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns, recyclableRender, components }","import mod from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-select.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\babel-loader\\\\lib\\\\index.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--13-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\script.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-select.vue?vue&type=script&lang=js&\"","<template>\r\n\t<view v-if=\"value\" class=\"tn-select-class tn-select\">\r\n\t\t<tn-popup v-model=\"value\" mode=\"bottom\" :popup=\"false\" length=\"auto\" :safeAreaInsetBottom=\"safeAreaInsetBottom\"\r\n\t\t\t:maskCloseable=\"maskCloseable\" :zIndex=\"elZIndex\" @close=\"close\">\r\n\t\t\t<view class=\"tn-select__content\" :style=\"{paddingBottom:safeAreaInsetBottom?'120rpx':'0'}\">\r\n\t\t\t\t<!-- 头部 -->\r\n\t\t\t\t<view class=\"tn-select__content__header\" @touchmove.stop.prevent>\r\n\t\t\t\t\t<view class=\"tn-select__content__header__btn tn-select__content__header--cancel\"\r\n\t\t\t\t\t\t:style=\"{ color: cancelColor }\" hover-class=\"tn-hover-class\" hover-stay-time=\"150\"\r\n\t\t\t\t\t\t@tap=\"getResult('cancel')\">{{ cancelText }}</view>\r\n\t\t\t\t\t<view class=\"tn-select__content__header__title\">{{ title }}</view>\r\n\t\t\t\t\t<view class=\"tn-select__content__header__btn tn-select__content__header--confirm\"\r\n\t\t\t\t\t\t:style=\"{ color: confirmColor }\" hover-class=\"tn-hover-class\" hover-stay-time=\"150\"\r\n\t\t\t\t\t\t@tap=\"getResult('confirm')\">{{ confirmText }}</view>\r\n\t\t\t\t</view>\r\n\t\t\t\t<!-- 列表内容 -->\r\n\r\n\t\t\t\t<view class=\"tn-select__content__body\">\r\n\t\t\t\t\t<view v-if=\"searchShow && mode==='single'\">\r\n\t\t\t\t\t\t<view class=\"tn-flex tn-select__content__body__search\">\r\n\t\t\t\t\t\t\t<view class=\"tn-icon-search tn-padding-sm\"></view>\r\n\t\t\t\t\t\t\t<input class=\"tn-select__content__body__search__input\" :placeholder=\"searchPlaceholder\"\r\n\t\t\t\t\t\t\t\tmaxlength=\"255\" confirm-type=\"search\" @input=\"searchInput\" @confirm=\"search\">\r\n\t\t\t\t\t\t</view>\r\n\t\t\t\t\t</view>\r\n\t\t\t\t\t<picker-view class=\"tn-select__content__body__view\" :value=\"defaultSelector\" @pickstart=\"pickStart\"\r\n\t\t\t\t\t\t@pickend=\"pickEnd\" @change=\"columnChange\">\r\n\r\n\t\t\t\t\t\t<picker-view-column v-for=\"(item, index) in columnData\" :key=\"index\">\r\n\t\t\t\t\t\t\t<view class=\"tn-select__content__body__item\" v-for=\"(sub_item, sub_index) in item\"\r\n\t\t\t\t\t\t\t\t:key=\"sub_index\">\r\n\t\t\t\t\t\t\t\t<view class=\"tn-text-ellipsis\">\r\n\t\t\t\t\t\t\t\t\t{{ sub_item[labelName] }}\r\n\t\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t\t</view>\r\n\t\t\t\t\t\t</picker-view-column>\r\n\t\t\t\t\t</picker-view>\r\n\t\t\t\t</view>\r\n\t\t\t</view>\r\n\t\t</tn-popup>\r\n\t</view>\r\n</template>\r\n\r\n<script>\r\n\texport default {\r\n\t\tname: 'tn-select',\r\n\t\tprops: {\r\n\t\t\tvalue: {\r\n\t\t\t\ttype: Boolean,\r\n\t\t\t\tdefault: false\r\n\t\t\t},\r\n\t\t\t// 列表模式\r\n\t\t\t// single 单列 multi 多列 multi-auto 多列联动\r\n\t\t\tmode: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: 'single'\r\n\t\t\t},\r\n\t\t\t// 列数据\r\n\t\t\tlist: {\r\n\t\t\t\ttype: Array,\r\n\t\t\t\tdefault () {\r\n\t\t\t\t\treturn []\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t// value属性名\r\n\t\t\tvalueName: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: 'value'\r\n\t\t\t},\r\n\t\t\t// label属性名\r\n\t\t\tlabelName: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: 'label'\r\n\t\t\t},\r\n\t\t\t// 当mode=multi-auto时,children的属性名\r\n\t\t\tchildName: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: 'children'\r\n\t\t\t},\r\n\t\t\t// 默认值\r\n\t\t\tdefaultValue: {\r\n\t\t\t\ttype: Array,\r\n\t\t\t\tdefault () {\r\n\t\t\t\t\treturn [0]\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t// 顶部标题\r\n\t\t\ttitle: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: ''\r\n\t\t\t},\r\n\t\t\t// 取消按钮文字\r\n\t\t\tcancelText: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: '取消'\r\n\t\t\t},\r\n\t\t\t// 取消按钮文字颜色\r\n\t\t\tcancelColor: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: ''\r\n\t\t\t},\r\n\t\t\t// 确认按钮文字\r\n\t\t\tconfirmText: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: '确认'\r\n\t\t\t},\r\n\t\t\t// 确认按钮文字颜色\r\n\t\t\tconfirmColor: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: ''\r\n\t\t\t},\r\n\t\t\t// 点击遮罩关闭\r\n\t\t\tmaskCloseable: {\r\n\t\t\t\ttype: Boolean,\r\n\t\t\t\tdefault: true\r\n\t\t\t},\r\n\t\t\t// 预留安全区域\r\n\t\t\tsafeAreaInsetBottom: {\r\n\t\t\t\ttype: Boolean,\r\n\t\t\t\tdefault: false\r\n\t\t\t},\r\n\t\t\t// zIndex\r\n\t\t\tzIndex: {\r\n\t\t\t\ttype: Number,\r\n\t\t\t\tdefault: 0\r\n\t\t\t},\r\n\t\t\t// 是否开启模糊搜索(只在单列模式生效)\r\n\t\t\tsearchShow: {\r\n\t\t\t\ttype: Boolean,\r\n\t\t\t\tdefault: true\r\n\t\t\t},\r\n\t\t\t//搜索框placeholder\r\n\t\t\tsearchPlaceholder: {\r\n\t\t\t\ttype: String,\r\n\t\t\t\tdefault: '搜索'\r\n\t\t\t}\r\n\t\t},\r\n\t\tcomputed: {\r\n\t\t\telZIndex() {\r\n\t\t\t\treturn this.zIndex ? this.zIndex : this.$tn.zIndex.popup\r\n\t\t\t}\r\n\t\t},\r\n\t\tdata() {\r\n\t\t\treturn {\r\n\t\t\t\t// 列是否还在滑动中,微信小程序如果在滑动中就点确定,结果可能不准确\r\n\t\t\t\tmoving: false,\r\n\t\t\t\t// 用户保存当前列的索引,用于判断下一次变化时改变的列\r\n\t\t\t\tdefaultSelector: [0],\r\n\t\t\t\t// picker-view数据\r\n\t\t\t\tcolumnData: [],\r\n\t\t\t\t// 保存用户选择的结果\r\n\t\t\t\tselectValue: [],\r\n\t\t\t\t// 上一次改变时的index\r\n\t\t\t\tlastSelectIndex: [],\r\n\t\t\t\t// 列数\r\n\t\t\t\tcolumnNum: 0,\r\n\r\n\t\t\t}\r\n\t\t},\r\n\t\twatch: {\r\n\t\t\t// 在select弹起的时候,重新初始化所有数据\r\n\t\t\tvalue: {\r\n\t\t\t\thandler(val) {\r\n\t\t\t\t\tif (val) setTimeout(() => this.init(), 10)\r\n\t\t\t\t},\r\n\t\t\t\timmediate: true\r\n\t\t\t}\r\n\t\t},\r\n\t\tmethods: {\r\n\t\t\t//搜索输入监听\r\n\t\t\tsearchInput(e) {\r\n\t\t\t\tconsole.log(e.detail.value);\r\n\t\t\t\tthis.searchResult(e.detail.value)\r\n\t\t\t},\r\n\t\t\t//搜索完成监听\r\n\t\t\tsearch(e) {\r\n\t\t\t\tconsole.log(e.detail.value)\r\n\t\t\t\tthis.searchResult(e.detail.value)\r\n\t\t\t},\r\n\t\t\t//执行搜索方法\r\n\t\t\tsearchResult(value) {\r\n\t\t\t\tlet result = [];\r\n\t\t\t\t// console.log(this.list)\r\n\t\t\t\tlet data = this.list.filter(item => item[this.labelName].indexOf(value) > -1);\r\n\t\t\t\tif (data.length > 0) {\r\n\t\t\t\t\tresult.push(data);\r\n\t\t\t\t}\r\n\t\t\t\t// console.log(result)\r\n\t\t\t\tthis.columnData = result;\r\n\t\t\t\tthis.selectValue = []\r\n\t\t\t\tif (this.columnData.length > 0) {\r\n\t\t\t\t\tthis.setSelectValue()\r\n\t\t\t\t}\r\n\t\t\t},\r\n\r\n\t\t\t// 标识滑动开始,只有微信小程序才有这样的事件\r\n\t\t\tpickStart() {\r\n\t\t\t\t// #ifdef MP-WEIXIN\r\n\t\t\t\tthis.moving = true;\r\n\t\t\t\t// #endif\r\n\t\t\t},\r\n\t\t\t// 标识滑动结束\r\n\t\t\tpickEnd() {\r\n\t\t\t\t// #ifdef MP-WEIXIN\r\n\t\t\t\tthis.moving = false;\r\n\t\t\t\t// #endif\r\n\t\t\t},\r\n\t\t\tinit() {\r\n\t\t\t\tthis.setColumnNum()\r\n\t\t\t\tthis.setDefaultSelector()\r\n\t\t\t\tthis.setColumnData()\r\n\t\t\t\tthis.setSelectValue()\r\n\t\t\t},\r\n\t\t\t// 获取默认选中列下标\r\n\t\t\tsetDefaultSelector() {\r\n\t\t\t\t// 如果没有传入默认值,生成用0填充长度为columnNum的数组\r\n\t\t\t\tthis.defaultSelector = this.defaultValue.length === this.columnNum ? this.defaultValue : Array(this\r\n\t\t\t\t\t.columnNum).fill(0)\r\n\t\t\t\tthis.lastSelectIndex = this.$tn.deepClone(this.defaultSelector)\r\n\t\t\t},\r\n\t\t\t// 计算列数\r\n\t\t\tsetColumnNum() {\r\n\t\t\t\t// 单列的数量为1\r\n\t\t\t\tif (this.mode === 'single') this.columnNum = 1\r\n\t\t\t\t// 多列时取list的长度\r\n\t\t\t\telse if (this.mode === 'multi') this.columnNum = this.list.length\r\n\t\t\t\t// 多列联动时,通过遍历list的第一个元素,得出有多少列\r\n\t\t\t\telse if (this.mode === 'multi-auto') {\r\n\t\t\t\t\tlet num = 1\r\n\t\t\t\t\tlet column = this.list\r\n\t\t\t\t\t// 如果存在children属性,再次遍历\r\n\t\t\t\t\twhile (column[0][this.childName]) {\r\n\t\t\t\t\t\tcolumn = column[0] ? column[0][this.childName] : {},\r\n\t\t\t\t\t\t\tnum++\r\n\t\t\t\t\t}\r\n\t\t\t\t\tthis.columnNum = num\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\t// 获取需要展示在picker中的列数据\r\n\t\t\tsetColumnData() {\r\n\t\t\t\tlet data = []\r\n\t\t\t\tthis.selectValue = []\r\n\t\t\t\tif (this.mode === 'multi-auto') {\r\n\t\t\t\t\t// 获取所有数据中的第一个元素\r\n\t\t\t\t\tlet column = this.list[this.defaultSelector.length ? this.defaultSelector[0] : 0]\r\n\t\t\t\t\t// 通过循环所有列数,再根据设定列的数组,得出当前需要渲染的整个列数组\r\n\t\t\t\t\tfor (let i = 0; i < this.columnNum; i++) {\r\n\t\t\t\t\t\t// 第一列默认为整个list数组\r\n\t\t\t\t\t\tif (i === 0) {\r\n\t\t\t\t\t\t\tdata[i] = this.list\r\n\t\t\t\t\t\t\tcolumn = column[this.childName]\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// 大于第一列时,判断是否有默认选中的,如果没有就用该列的第一项\r\n\t\t\t\t\t\t\tdata[i] = column\r\n\t\t\t\t\t\t\tcolumn = column[this.defaultSelector[i]][this.childName]\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else if (this.mode === 'single') {\r\n\t\t\t\t\tdata[0] = this.list\r\n\t\t\t\t} else {\r\n\t\t\t\t\tdata = this.list\r\n\t\t\t\t}\r\n\t\t\t\tthis.columnData = data\r\n\t\t\t},\r\n\t\t\t// 获取默认选中的值,如果没有设置,则默认选中第一项\r\n\t\t\tsetSelectValue() {\r\n\t\t\t\tlet tmp = null\r\n\t\t\t\tfor (let i = 0; i < this.columnNum; i++) {\r\n\t\t\t\t\ttmp = this.columnData[i][this.defaultSelector[i]]\r\n\t\t\t\t\tlet data = {\r\n\t\t\t\t\t\tvalue: tmp ? tmp[this.valueName] : null,\r\n\t\t\t\t\t\tlabel: tmp ? tmp[this.labelName] : null\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// 判断是否存在额外的参数\r\n\t\t\t\t\tif (tmp && tmp.extra) data.extra = tmp.extra\r\n\t\t\t\t\tthis.selectValue.push(data)\r\n\t\t\t\t}\r\n\t\t\t\t// console.log(\"默认\",this.selectValue)\r\n\t\t\t},\r\n\t\t\t// 列选项\r\n\t\t\tcolumnChange(event) {\r\n\t\t\t\tlet index = null\r\n\t\t\t\tlet columnIndex = event.detail.value\r\n\r\n\t\t\t\tthis.selectValue = []\r\n\t\t\t\tif (this.mode === 'multi-auto') {\r\n\t\t\t\t\t// 对比前后两个数组,判断变更的是那一列\r\n\t\t\t\t\tthis.lastSelectIndex.map((v, idx) => {\r\n\t\t\t\t\t\tif (v != columnIndex[idx]) index = idx\r\n\t\t\t\t\t})\r\n\t\t\t\t\tthis.defaultSelector = columnIndex\r\n\t\t\t\t\t// 当前变化列的下一列的数据,需要获取上一列的数据,同时需要指定是上一列的第几个的children,再往后的\r\n\t\t\t\t\t// 默认是队列的第一个为默认选项\r\n\t\t\t\t\tfor (let i = index + 1; i < this.columnNum; i++) {\r\n\t\t\t\t\t\tthis.columnData[i] = this.columnData[i - 1][i - 1 == index ? columnIndex[index] : 0][this\r\n\t\t\t\t\t\t\t.childName\r\n\t\t\t\t\t\t]\r\n\t\t\t\t\t\tthis.defaultSelector[i] = 0\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// 在历遍的过程中,可能由于上一步修改this.columnData,导致产生连锁反应,程序触发columnChange,会有多次调用\r\n\t\t\t\t\t// 只有在最后一次数据稳定后的结果是正确的,此前的历遍中,可能会产生undefined,故需要判断\r\n\t\t\t\t\tcolumnIndex.map((item, index) => {\r\n\t\t\t\t\t\tlet data = this.columnData[index][columnIndex[index]]\r\n\t\t\t\t\t\tlet tmp = {\r\n\t\t\t\t\t\t\tvalue: data ? data[this.valueName] : null,\r\n\t\t\t\t\t\t\tlabel: data ? data[this.labelName] : null\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (data && data.extra !== undefined) tmp.extra = data.extra\r\n\t\t\t\t\t\tthis.selectValue.push(tmp)\r\n\t\t\t\t\t})\r\n\t\t\t\t\tthis.lastSelectIndex = columnIndex\r\n\t\t\t\t} else if (this.mode === 'single') {\r\n\t\t\t\t\tlet data = this.columnData[0][columnIndex[0]]\r\n\t\t\t\t\tlet tmp = {\r\n\t\t\t\t\t\tvalue: data ? data[this.valueName] : null,\r\n\t\t\t\t\t\tlabel: data ? data[this.labelName] : null\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (data && data.extra !== undefined) tmp.extra = data.extra\r\n\t\t\t\t\tthis.selectValue.push(tmp)\r\n\t\t\t\t} else if (this.mode === 'multi') {\r\n\t\t\t\t\tcolumnIndex.map((item, index) => {\r\n\t\t\t\t\t\tlet data = this.columnData[index][columnIndex[index]]\r\n\t\t\t\t\t\tlet tmp = {\r\n\t\t\t\t\t\t\tvalue: data ? data[this.valueName] : null,\r\n\t\t\t\t\t\t\tlabel: data ? data[this.labelName] : null\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (data && data.extra !== undefined) tmp.extra = data.extra\r\n\t\t\t\t\t\tthis.selectValue.push(tmp)\r\n\t\t\t\t\t})\r\n\t\t\t\t}\r\n\t\t\t},\r\n\t\t\tclose() {\r\n\t\t\t\tthis.$emit('input', false)\r\n\t\t\t},\r\n\t\t\tgetResult(event = null) {\r\n\t\t\t\t// #ifdef MP-WEIXIN\r\n\t\t\t\tif (this.moving) return;\r\n\t\t\t\t// #endif\r\n\t\t\t\tif (event) this.$emit(event, this.selectValue)\r\n\t\t\t\tthis.close()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n\t.tn-select {\r\n\r\n\t\t&__content {\r\n\t\t\tposition: relative;\r\n\r\n\t\t\t&__header {\r\n\t\t\t\tposition: relative;\r\n\t\t\t\tdisplay: flex;\r\n\t\t\t\tflex-direction: row;\r\n\t\t\t\twidth: 100%;\r\n\t\t\t\theight: 90rpx;\r\n\t\t\t\tpadding: 0 40rpx;\r\n\t\t\t\talign-items: center;\r\n\t\t\t\tjustify-content: space-between;\r\n\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\tfont-size: 30rpx;\r\n\t\t\t\tbackground-color: #FFFFFF;\r\n\r\n\t\t\t\t&__btn {\r\n\t\t\t\t\tpadding: 16rpx;\r\n\t\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\t\ttext-align: center;\r\n\t\t\t\t\ttext-decoration: none;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&__title {\r\n\t\t\t\t\tcolor: $tn-font-color;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&--cancel {\r\n\t\t\t\t\tcolor: $tn-font-sub-color;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&--confirm {\r\n\t\t\t\t\t// color: $tn-main-color;\r\n\t\t\t\t\tbackground-color: #07C160;\r\n\t\t\t\t\tcolor: #FFFFFF;\r\n\t\t\t\t\tpadding: 10rpx 25rpx;\r\n\t\t\t\t\tborder-radius: 10rpx;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t&__body {\r\n\t\t\t\twidth: 100%;\r\n\t\t\t\theight: 500rpx;\r\n\t\t\t\toverflow: hidden;\r\n\t\t\t\tbackground-color: #FFFFFF;\r\n\r\n\t\t\t\t&__search {\r\n\t\t\t\t\tz-index: 5;\r\n\t\t\t\t\talign-items: center;\r\n\t\t\t\t\tborder-radius: 19px;\r\n\t\t\t\t\tbackground: #f8f8f8;\r\n\t\t\t\t\twidth: calc(100% - 60rpx);\r\n\t\t\t\t\tmargin: 0 auto;\r\n\t\t\t\t\tposition: relative;\r\n\t\t\t\t\ttop: 15px;\r\n\r\n\t\t\t\t\t&__input {\r\n\t\t\t\t\t\twidth: 600rpx;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&__view {\r\n\t\t\t\t\theight: 100%;\r\n\t\t\t\t\tbox-sizing: border-box;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t&__item {\r\n\t\t\t\t\tdisplay: flex;\r\n\t\t\t\t\tflex-direction: row;\r\n\t\t\t\t\talign-items: center;\r\n\t\t\t\t\tjustify-content: center;\r\n\t\t\t\t\tfont-size: 32rpx;\r\n\t\t\t\t\tcolor: $tn-font-color;\r\n\t\t\t\t\tpadding: 0 8rpx;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t}\r\n</style>","import mod from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\mini-css-extract-plugin\\\\dist\\\\loader.js??ref--8-oneOf-1-0!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\css-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\stylePostLoader.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-2!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\postcss-loader\\\\src\\\\index.js??ref--8-oneOf-1-3!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\sass-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-4!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-5!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-select.vue?vue&type=style&index=0&id=a65b9b48&lang=scss&scoped=true&\"; export default mod; export * from \"-!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\mini-css-extract-plugin\\\\dist\\\\loader.js??ref--8-oneOf-1-0!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\css-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-1!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\loaders\\\\stylePostLoader.js!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-2!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\postcss-loader\\\\src\\\\index.js??ref--8-oneOf-1-3!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\sass-loader\\\\dist\\\\cjs.js??ref--8-oneOf-1-4!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\webpack-preprocess-loader\\\\index.js??ref--8-oneOf-1-5!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\vue-cli-plugin-uni\\\\packages\\\\vue-loader\\\\lib\\\\index.js??vue-loader-options!F:\\\\HBuilderX.3.5.3.20220729\\\\HBuilderX\\\\plugins\\\\uniapp-cli\\\\node_modules\\\\@dcloudio\\\\webpack-uni-mp-loader\\\\lib\\\\style.js!./tn-select.vue?vue&type=style&index=0&id=a65b9b48&lang=scss&scoped=true&\"","// extracted by mini-css-extract-plugin\n if(module.hot) {\n // 1716771381630\n var cssReload = require(\"F:/HBuilderX.3.5.3.20220729/HBuilderX/plugins/uniapp-cli/node_modules/mini-css-extract-plugin/dist/hmr/hotModuleReplacement.js\")(module.id, {\"hmr\":true,\"publicPath\":\"/\",\"locals\":false});\n module.hot.dispose(cssReload);\n module.hot.accept(undefined, cssReload);\n }\n "],"sourceRoot":""} |