first commit
This commit is contained in:
22
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/props.js
vendored
Normal file
22
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/props.js
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_libs_config_props = require("../../libs/config/props.js");
|
||||
const props = {
|
||||
props: {
|
||||
// 分成几列
|
||||
col: {
|
||||
type: [String, Number],
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.grid.col
|
||||
},
|
||||
// 是否显示边框
|
||||
border: {
|
||||
type: Boolean,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.grid.border
|
||||
},
|
||||
// 宫格对齐方式,表现为数量少的时候,靠左,居中,还是靠右
|
||||
align: {
|
||||
type: String,
|
||||
default: () => uni_modules_uviewPlus_libs_config_props.defProps.grid.align
|
||||
}
|
||||
}
|
||||
};
|
||||
exports.props = props;
|
||||
72
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.js
vendored
Normal file
72
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.js
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
"use strict";
|
||||
const uni_modules_uviewPlus_components_uGrid_props = require("./props.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mpMixin = require("../../libs/mixin/mpMixin.js");
|
||||
const uni_modules_uviewPlus_libs_mixin_mixin = require("../../libs/mixin/mixin.js");
|
||||
const uni_modules_uviewPlus_libs_function_index = require("../../libs/function/index.js");
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const _sfc_main = {
|
||||
name: "u-grid",
|
||||
mixins: [uni_modules_uviewPlus_libs_mixin_mpMixin.mpMixin, uni_modules_uviewPlus_libs_mixin_mixin.mixin, uni_modules_uviewPlus_components_uGrid_props.props],
|
||||
data() {
|
||||
return {
|
||||
index: 0,
|
||||
width: 0
|
||||
};
|
||||
},
|
||||
watch: {
|
||||
// 当父组件需要子组件需要共享的参数发生了变化,手动通知子组件
|
||||
parentData() {
|
||||
if (this.children.length) {
|
||||
this.children.map((child) => {
|
||||
typeof child.updateParentData == "function" && child.updateParentData();
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.children = [];
|
||||
},
|
||||
computed: {
|
||||
// 计算父组件的值是否发生变化
|
||||
parentData() {
|
||||
return [this.hoverClass, this.col, this.size, this.border];
|
||||
},
|
||||
// 宫格对齐方式
|
||||
gridStyle() {
|
||||
let style = {};
|
||||
switch (this.align) {
|
||||
case "left":
|
||||
style.justifyContent = "flex-start";
|
||||
break;
|
||||
case "center":
|
||||
style.justifyContent = "center";
|
||||
break;
|
||||
case "right":
|
||||
style.justifyContent = "flex-end";
|
||||
break;
|
||||
default:
|
||||
style.justifyContent = "flex-start";
|
||||
}
|
||||
return uni_modules_uviewPlus_libs_function_index.deepMerge(style, uni_modules_uviewPlus_libs_function_index.addStyle(this.customStyle));
|
||||
}
|
||||
},
|
||||
emits: ["click"],
|
||||
// 防止事件执行两次
|
||||
// 20240409发现抖音小程序如果开启virtualHost会出现严重问题,几乎所有事件包括created等生命周期事件全部失效。
|
||||
options: {
|
||||
// virtualHost: true ,//将自定义节点设置成虚拟的,更加接近Vue组件的表现。我们不希望自定义组件的这个节点本身可以设置样式、响应 flex 布局等
|
||||
},
|
||||
methods: {
|
||||
// 此方法由u-grid-item触发,用于在u-grid发出事件
|
||||
childClick(name) {
|
||||
this.$emit("click", name);
|
||||
}
|
||||
}
|
||||
};
|
||||
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
||||
return {
|
||||
a: common_vendor.s($options.gridStyle)
|
||||
};
|
||||
}
|
||||
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-10b668c8"]]);
|
||||
wx.createComponent(Component);
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="u-grid data-v-10b668c8" ref="u-grid" style="{{a}}"><slot/></view>
|
||||
28
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxss
vendored
Normal file
28
unpackage/dist/dev/mp-weixin/uni_modules/uview-plus/components/u-grid/u-grid.wxss
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
.u-empty.data-v-10b668c8,
|
||||
.u-empty__wrap.data-v-10b668c8,
|
||||
.u-tabs.data-v-10b668c8,
|
||||
.u-tabs__wrapper.data-v-10b668c8,
|
||||
.u-tabs__wrapper__scroll-view-wrapper.data-v-10b668c8,
|
||||
.u-tabs__wrapper__scroll-view.data-v-10b668c8,
|
||||
.u-tabs__wrapper__nav.data-v-10b668c8,
|
||||
.u-tabs__wrapper__nav__line.data-v-10b668c8 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex-shrink: 0;
|
||||
flex-grow: 0;
|
||||
flex-basis: auto;
|
||||
align-items: stretch;
|
||||
align-content: flex-start;
|
||||
}
|
||||
.u-grid.data-v-10b668c8 {
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
overflow: hidden;
|
||||
display: block;
|
||||
justify-content: center;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
}
|
||||
Reference in New Issue
Block a user