12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <template>
- <view
- class="u-line"
- :style="[lineStyle]"
- >
- </view>
- </template>
- <script>
- import props from './props.js';
- import mpMixin from '../../libs/mixin/mpMixin.js';
- import mixin from '../../libs/mixin/mixin.js';
-
- 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 = uni.$u.addUnit(this.length)
- if (this.hairline) style.transform = 'scaleY(0.5)'
- } else {
-
- style.borderLeftWidth = '1px'
- style.borderLeftStyle = this.dashed ? 'dashed' : 'solid'
- style.height = uni.$u.addUnit(this.length)
- if (this.hairline) style.transform = 'scaleX(0.5)'
- }
- style.borderColor = this.color
- return uni.$u.deepMerge(style, uni.$u.addStyle(this.customStyle))
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/components.scss";
- .u-line {
-
- vertical-align: middle;
-
- }
- </style>
|