song-ui-u
Version:
vue3 + js的PC前端组件库
95 lines (84 loc) • 2.7 kB
JavaScript
'use strict';
var vue = require('vue');
var index$1 = require('../../../hook/use-namespace/index.cjs');
var index = require('../../../hook/use-style/index.cjs');
require('../../../hook/use-zindex/index.cjs');
var _pluginVue_exportHelper = require('../../../_virtual/_plugin-vue_export-helper.cjs');
// 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 = index.useStyle();
const props = __props;
const ns = index$1.useNamespace("divider");
// 宽度
const styleWidth = vue.computed(() => uStyle.width(props.width));
// 颜色
const styleColor = vue.computed(() => uStyle.color(props.color));
// 边距
const stylePadding = vue.computed(() =>
props.padding ? { padding: `0 ${props.padding}px` } : ""
);
// 偏移
const styleOffset = vue.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: vue.ref, computed: vue.computed, get useNamespace() { return index$1.useNamespace }, get useStyle() { return index.useStyle } };
Object.defineProperty(__returned__, '__isScriptSetup', { enumerable: false, value: true });
return __returned__
}
});
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
return (vue.openBlock(), vue.createElementBlock("div", {
class: vue.normalizeClass([$setup.ns.b(), $setup.ns.e($props.direction)]),
style: vue.normalizeStyle([$setup.styleWidth])
}, [
vue.createElementVNode("div", {
class: vue.normalizeClass([$setup.ns.e('content'), $setup.ns.m('position', $props.position)]),
style: vue.normalizeStyle([$setup.styleColor, $setup.styleOffset, $setup.stylePadding])
}, vue.toDisplayString($props.content), 7 /* TEXT, CLASS, STYLE */)
], 6 /* CLASS, STYLE */))
}
var Divider = /*#__PURE__*/_pluginVue_exportHelper(_sfc_main, [['render',_sfc_render],['__file',"E:\\code\\my-code\\song-ui-ultra\\packages\\components\\divider\\src\\index.vue"]]);
module.exports = Divider;
//# sourceMappingURL=index.vue.cjs.map