1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <template>
- <view
- class="u-line"
- :style="[lineStyle]"
- >
- </view>
- </template>
- <script>
- import { props } from './props';
- import { mpMixin } from '../../libs/mixin/mpMixin';
- import { mixin } from '../../libs/mixin/mixin';
- import { addUnit, addStyle, deepMerge } from '../../libs/function/index';
-
- export default {
- name: 'u-line',
- mixins: [mpMixin, mixin, props],
- computed: {
- lineStyle() {
- const style = {}
- style.margin = this.margin
-
- if (this.direction === 'row') {
-
- style.borderBottomWidth = '1px'
- style.borderBottomStyle = this.dashed ? 'dashed' : 'solid'
- style.width = addUnit(this.length)
- if (this.hairline) style.transform = 'scaleY(0.5)'
- } else {
-
- style.borderLeftWidth = '1px'
- style.borderLeftStyle = this.dashed ? 'dashed' : 'solid'
- style.height = addUnit(this.length)
- if (this.hairline) style.transform = 'scaleX(0.5)'
- }
- style.borderColor = this.color
- return deepMerge(style, addStyle(this.customStyle))
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/components.scss";
- .u-line {
-
- vertical-align: middle;
-
- }
- </style>
|