song-ui-u
Version:
vue3 + js的PC前端组件库
93 lines (83 loc) • 2.68 kB
JavaScript
import { computed, openBlock, createElementBlock, normalizeClass, normalizeStyle, createElementVNode, toDisplayString, ref } from 'vue';
import { useNamespace } from '../../../hook/use-namespace/index.mjs';
import { useStyle } from '../../../hook/use-style/index.mjs';
import '../../../hook/use-zindex/index.mjs';
import _export_sfc from '../../../_virtual/_plugin-vue_export-helper.mjs';
// style
const __default__ = { name: "x-divider" };
const _sfc_main = /*#__PURE__*/Object.assign(__default__, {
props: {
direction: {
type: String,
default: "horizontal",
},
position: {
type: String,
default: "left",
},
content: {
type: String,
default: "",
},
width: {
type: String,
default: "",
},
color: {
type: String,
default: "",
},
offset: {
type: Number,
default: 0,
},
padding: {
type: Number,
default: 0,
},
},
setup(__props, { expose: __expose }) {
__expose();
const uStyle = useStyle();
const props = __props;
const ns = useNamespace("divider");
// 宽度
const styleWidth = computed(() => uStyle.width(props.width));
// 颜色
const styleColor = computed(() => uStyle.color(props.color));
// 边距
const stylePadding = computed(() =>
props.padding ? { padding: `0 ${props.padding}px` } : ""
);
// 偏移
const styleOffset = computed(() => {
if (!props.offset) {
return "";
}
if (props.position === "left") {
return { left: `${props.offset}px` };
}
if (props.position === "right") {
return { right: `${props.offset}px` };
}
return "";
});
const __returned__ = { uStyle, props, ns, styleWidth, styleColor, stylePadding, styleOffset, ref, computed, get useNamespace() { return useNamespace }, get useStyle() { return useStyle } };
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
return __returned__
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return (openBlock(), createElementBlock("div", {
class: normalizeClass([$setup.ns.b(), $setup.ns.e($props.direction)]),
style: normalizeStyle([$setup.styleWidth])
}, [
createElementVNode("div", {
class: normalizeClass([$setup.ns.e('content'), $setup.ns.m('position', $props.position)]),
style: normalizeStyle([$setup.styleColor, $setup.styleOffset, $setup.stylePadding])
}, toDisplayString($props.content), 7 /* TEXT, CLASS, STYLE */)
], 6 /* CLASS, STYLE */))
}
var Divider = /*#__PURE__*/_export_sfc(_sfc_main, [['render',_sfc_render],['__file',"E:\\code\\my-code\\song-ui-ultra\\packages\\components\\divider\\src\\index.vue"]]);
export { Divider as default };
//# sourceMappingURL=index.vue.mjs.map