init
This commit is contained in:
113
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.js
vendored
Normal file
113
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.js
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../../common/vendor.js");
|
||||
const uni_modules_nutuiUni_components__constants_event = require("../_constants/event.js");
|
||||
const uni_modules_nutuiUni_components__constants_prefix = require("../_constants/prefix.js");
|
||||
const uni_modules_nutuiUni_components__hooks_useInject = require("../_hooks/useInject.js");
|
||||
const uni_modules_nutuiUni_components__hooks_useRouter = require("../_hooks/useRouter.js");
|
||||
require("../_utils/env.js");
|
||||
const uni_modules_nutuiUni_components__utils_pxCheck = require("../_utils/pxCheck.js");
|
||||
const uni_modules_nutuiUni_components__utils_style = require("../_utils/style.js");
|
||||
const uni_modules_nutuiUni_components_grid_index = require("../grid/index.js");
|
||||
const uni_modules_nutuiUni_components__utils_props = require("../_utils/props.js");
|
||||
const gridItemProps = {
|
||||
...uni_modules_nutuiUni_components__utils_props.commonProps,
|
||||
/**
|
||||
* @description 文字
|
||||
*/
|
||||
text: String,
|
||||
/**
|
||||
* @description 点击后跳转的目标路由对象,同 vue-router 的 to 属性
|
||||
*/
|
||||
to: [String, Object],
|
||||
/**
|
||||
* @description 点击后跳转的链接地址
|
||||
*/
|
||||
url: String,
|
||||
/**
|
||||
* @description 是否在跳转时替换当前页面历史
|
||||
*/
|
||||
replace: Boolean,
|
||||
background: String
|
||||
};
|
||||
const gridItemEmits = {
|
||||
[uni_modules_nutuiUni_components__constants_event.CLICK_EVENT]: (evt) => evt instanceof Object
|
||||
};
|
||||
const __default__ = common_vendor.defineComponent({
|
||||
name: "NutGridItem",
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: "shared"
|
||||
}
|
||||
});
|
||||
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
||||
...__default__,
|
||||
props: gridItemProps,
|
||||
emits: gridItemEmits,
|
||||
setup(__props, { emit: __emit }) {
|
||||
var _a;
|
||||
const props = __props;
|
||||
const emit = __emit;
|
||||
const componentName = `${uni_modules_nutuiUni_components__constants_prefix.PREFIX}-grid-item`;
|
||||
const Parent = uni_modules_nutuiUni_components__hooks_useInject.useInject(uni_modules_nutuiUni_components_grid_index.GRID_KEY);
|
||||
const index = Parent.index;
|
||||
const parent = (_a = Parent == null ? void 0 : Parent.parent) == null ? void 0 : _a.props;
|
||||
const classes = common_vendor.computed(() => {
|
||||
return uni_modules_nutuiUni_components__utils_style.getMainClass(props, componentName);
|
||||
});
|
||||
const styles = common_vendor.computed(() => {
|
||||
if (!parent)
|
||||
return;
|
||||
const style = {
|
||||
flexBasis: `${100 / +parent.columnNum}%`
|
||||
};
|
||||
if (parent == null ? void 0 : parent.square) {
|
||||
style.paddingTop = `${100 / +parent.columnNum}%`;
|
||||
} else if (parent.gutter) {
|
||||
style.paddingRight = uni_modules_nutuiUni_components__utils_pxCheck.pxCheck(parent.gutter);
|
||||
if (index.value >= Number(parent.columnNum))
|
||||
style.marginTop = uni_modules_nutuiUni_components__utils_pxCheck.pxCheck(parent.gutter);
|
||||
}
|
||||
return uni_modules_nutuiUni_components__utils_style.getMainStyle(props, style);
|
||||
});
|
||||
const contentClass = common_vendor.computed(() => {
|
||||
if (!parent)
|
||||
return;
|
||||
const prefixCls = `${componentName}__content`;
|
||||
return {
|
||||
[`${prefixCls}`]: true,
|
||||
[`${prefixCls}--border`]: parent.border,
|
||||
[`${prefixCls}--surround`]: parent.border && parent.gutter,
|
||||
[`${prefixCls}--center`]: parent.center,
|
||||
[`${prefixCls}--square`]: parent.square,
|
||||
[`${prefixCls}--reverse`]: parent.reverse,
|
||||
[`${prefixCls}--${parent.direction}`]: !!parent.direction,
|
||||
[`${prefixCls}--clickable`]: parent.clickable
|
||||
};
|
||||
});
|
||||
const router = uni_modules_nutuiUni_components__hooks_useRouter.useRouter();
|
||||
function handleClick(event) {
|
||||
emit(uni_modules_nutuiUni_components__constants_event.CLICK_EVENT, event);
|
||||
if (props.to && router) {
|
||||
router[props.replace ? "replace" : "push"](props.to);
|
||||
}
|
||||
}
|
||||
return (_ctx, _cache) => {
|
||||
return common_vendor.e({
|
||||
a: _ctx.text
|
||||
}, _ctx.text ? {
|
||||
b: common_vendor.t(_ctx.text)
|
||||
} : {}, {
|
||||
c: common_vendor.n(contentClass.value),
|
||||
d: common_vendor.s(props.background ? {
|
||||
background: props.background
|
||||
} : {}),
|
||||
e: common_vendor.n(classes.value),
|
||||
f: common_vendor.s(styles.value),
|
||||
g: common_vendor.o(handleClick)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
wx.createComponent(_sfc_main);
|
||||
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.js.map
|
||||
4
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.json
vendored
Normal file
4
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
1
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.wxml
vendored
Normal file
1
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.wxml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<view class="{{e}}" style="{{f}}" bindtap="{{g}}"><view class="{{c}}" style="{{d}}"><slot/><view class="nut-grid-item__text"><block wx:if="{{a}}">{{b}}</block><slot wx:else name="text"/></view></view></view>
|
||||
134
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.wxss
vendored
Normal file
134
unpackage/dist/dev/mp-weixin/uni_modules/nutui-uni/components/griditem/griditem.wxss
vendored
Normal file
@@ -0,0 +1,134 @@
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
/**
|
||||
* 这里是uni-app内置的常用样式变量
|
||||
*
|
||||
* uni-app 官方扩展插件及插件市场(https://ext.dcloud.net.cn)上很多三方插件均使用了这些样式变量
|
||||
* 如果你是插件开发者,建议你使用scss预处理,并在插件代码中直接使用这些变量(无需 import 这个文件),方便用户通过搭积木的方式开发整体风格一致的App
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* 如果你是App开发者(插件使用者),你可以通过修改这些变量来定制自己的插件主题,实现自定义主题功能
|
||||
*
|
||||
* 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
|
||||
*/
|
||||
/* 颜色变量 */
|
||||
/* 行为相关颜色 */
|
||||
/* 文字基本颜色 */
|
||||
/* 背景颜色 */
|
||||
/* 边框颜色 */
|
||||
/* 尺寸变量 */
|
||||
/* 文字尺寸 */
|
||||
/* 图片尺寸 */
|
||||
/* Border Radius */
|
||||
/* 水平间距 */
|
||||
/* 垂直间距 */
|
||||
/* 透明度 */
|
||||
/* 文章场景相关 */
|
||||
.nut-theme-dark .nut-grid-item__content {
|
||||
color: var(--nut-dark-color, var(--nut-white, #fff));
|
||||
background: var(--nut-dark-background, #131313);
|
||||
border: 0 solid var(--nut-dark-background2, #1b1b1b);
|
||||
}
|
||||
.nut-theme-dark .nut-grid-item__text {
|
||||
color: var(--nut-dark-color, var(--nut-white, #fff));
|
||||
}
|
||||
.nut-grid-item {
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nut-grid-item__text {
|
||||
margin: var(--nut-grid-item-text-margin, 8px) 0 0 0;
|
||||
font-size: var(--nut-grid-item-text-font-size, var(--nut-font-size-1, 12px));
|
||||
line-height: 1.5;
|
||||
color: var(--nut-grid-item-text-color, var(--nut-title-color2, #666));
|
||||
word-break: break-all;
|
||||
}
|
||||
.nut-grid-item__content {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
padding: var(--nut-grid-item-content-padding, 16px 8px);
|
||||
background: var(--nut-grid-item-content-bg-color, var(--nut-white, #fff));
|
||||
border: 0 solid var(--nut-grid-border-color, #f5f6f7);
|
||||
}
|
||||
.nut-grid-item__content--border {
|
||||
border-right-width: 1px;
|
||||
border-bottom-width: 1px;
|
||||
}
|
||||
.nut-grid-item__content--surround {
|
||||
border-top-width: 1px;
|
||||
border-left-width: 1px;
|
||||
}
|
||||
.nut-grid-item__content--center {
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
.nut-grid-item__content--square {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
.nut-grid-item__content--reverse {
|
||||
flex-direction: column-reverse;
|
||||
}
|
||||
.nut-grid-item__content--reverse .nut-grid-item__text {
|
||||
margin: 0 0 var(--nut-grid-item-text-margin, 8px);
|
||||
}
|
||||
.nut-grid-item__content--horizontal {
|
||||
flex-direction: row;
|
||||
}
|
||||
.nut-grid-item__content--horizontal .nut-grid-item__text {
|
||||
margin: 0 0 0 var(--nut-grid-item-text-margin, 8px);
|
||||
}
|
||||
.nut-grid-item__content--horizontal.nut-grid-item__content--reverse {
|
||||
flex-direction: row-reverse;
|
||||
}
|
||||
.nut-grid-item__content--horizontal.nut-grid-item__content--reverse .nut-grid-item__text {
|
||||
margin: 0 var(--nut-grid-item-text-margin, 8px) 0 0;
|
||||
}
|
||||
.nut-grid-item__content--clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
.nut-grid-item__content--clickable::before {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
content: "";
|
||||
background-color: var(--nut-black, #000);
|
||||
border: inherit;
|
||||
border-color: var(--nut-black, #000);
|
||||
border-radius: inherit;
|
||||
opacity: 0;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.nut-grid-item__content--clickable:active::before {
|
||||
opacity: 0.1;
|
||||
}
|
||||
Reference in New Issue
Block a user