1 line
5.0 KiB
Plaintext
1 line
5.0 KiB
Plaintext
{"version":3,"file":"uni-grid.js","sources":["../../../../../../../src/uni_modules/uni-grid/components/uni-grid/uni-grid.vue","../../../../../../../uniComponent:/RDovQXBwL1dvcmsvYWRkci9hY2RyLXVpL3NyYy91bmlfbW9kdWxlcy91bmktZ3JpZC9jb21wb25lbnRzL3VuaS1ncmlkL3VuaS1ncmlkLnZ1ZQ"],"sourcesContent":["<template>\r\n <view class=\"uni-grid-wrap\">\r\n <view\r\n :id=\"elId\"\r\n ref=\"uni-grid\"\r\n class=\"uni-grid\"\r\n :class=\"{ 'uni-grid--border': showBorder }\"\r\n :style=\"{ 'border-left-color': borderColor }\"\r\n >\r\n <slot />\r\n </view>\r\n </view>\r\n</template>\r\n\r\n<script>\r\n// #ifdef APP-NVUE\r\nconst dom = uni.requireNativePlugin('dom')\r\n// #endif\r\n\r\n/**\r\n * Grid 宫格\r\n * @description 宫格组件\r\n * @tutorial https://ext.dcloud.net.cn/plugin?id=27\r\n * @property {Number} column 每列显示个数\r\n * @property {String} borderColor 边框颜色\r\n * @property {Boolean} showBorder 是否显示边框\r\n * @property {Boolean} square 是否方形显示\r\n * @property {Boolean} Boolean 点击背景是否高亮\r\n * @event {Function} change 点击 grid 触发,e={detail:{index:0}},index 为当前点击 gird 下标\r\n */\r\nexport default {\r\n name: 'UniGrid',\r\n emits: ['change'],\r\n props: {\r\n // 每列显示个数\r\n column: {\r\n type: Number,\r\n default: 3,\r\n },\r\n // 是否显示边框\r\n showBorder: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n // 边框颜色\r\n borderColor: {\r\n type: String,\r\n default: '#D2D2D2',\r\n },\r\n // 是否正方形显示,默认为 true\r\n square: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n highlight: {\r\n type: Boolean,\r\n default: true,\r\n },\r\n },\r\n provide() {\r\n return {\r\n grid: this,\r\n }\r\n },\r\n data() {\r\n const elId = `Uni_${Math.ceil(Math.random() * 10e5).toString(36)}`\r\n return {\r\n elId,\r\n width: 0,\r\n }\r\n },\r\n created() {\r\n this.children = []\r\n },\r\n mounted() {\r\n this.$nextTick(() => {\r\n this.init()\r\n })\r\n },\r\n methods: {\r\n init() {\r\n setTimeout(() => {\r\n this._getSize((width) => {\r\n this.children.forEach((item, index) => {\r\n item.width = width\r\n })\r\n })\r\n }, 50)\r\n },\r\n change(e) {\r\n this.$emit('change', e)\r\n },\r\n _getSize(fn) {\r\n // #ifndef APP-NVUE\r\n uni\r\n .createSelectorQuery()\r\n .in(this)\r\n .select(`#${this.elId}`)\r\n .boundingClientRect()\r\n .exec((ret) => {\r\n this.width = parseInt((ret[0].width - 1) / this.column) + 'px'\r\n fn(this.width)\r\n })\r\n // #endif\r\n // #ifdef APP-NVUE\r\n dom.getComponentRect(this.$refs['uni-grid'], (ret) => {\r\n this.width = parseInt((ret.size.width - 1) / this.column) + 'px'\r\n fn(this.width)\r\n })\r\n // #endif\r\n },\r\n },\r\n}\r\n</script>\r\n\r\n<style lang=\"scss\" scoped>\r\n.uni-grid-wrap {\r\n /* #ifndef APP-NVUE */\r\n display: flex;\r\n /* #endif */\r\n flex: 1;\r\n flex-direction: column;\r\n /* #ifdef H5 */\r\n width: 100%;\r\n /* #endif */\r\n}\r\n\r\n.uni-grid {\r\n /* #ifndef APP-NVUE */\r\n display: flex;\r\n /* #endif */\r\n // flex: 1;\r\n flex-direction: row;\r\n flex-wrap: wrap;\r\n}\r\n\r\n.uni-grid--border {\r\n position: relative;\r\n /* #ifdef APP-NVUE */\r\n border-left-color: #d2d2d2;\r\n border-left-style: solid;\r\n border-left-width: 0.5px;\r\n /* #endif */\r\n /* #ifndef APP-NVUE */\r\n z-index: 1;\r\n border-left: 1px #d2d2d2 solid;\r\n /* #endif */\r\n}\r\n</style>\r\n","import Component from 'D:/App/Work/addr/acdr-ui/src/uni_modules/uni-grid/components/uni-grid/uni-grid.vue'\nwx.createComponent(Component)"],"names":["uni"],"mappings":";;AA8BA,MAAK,YAAU;AAAA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