1.结果展示:
2.代码展示:
- <template>
- <div class="container">
- <div class="column" v-for="(item, index) in items" :key="index">
- <div class="item">{{ item }}</div>
- <div v-if="index % 2 !== 0" class="divider"></div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data() {
- return {
- items: ['Item 1', 'Item 2', 'Item 3', 'Item 4', 'Item 5']
- };
- }
- };
- </script>
- <style scoped>
- .container {
- display: flex;
- flex-wrap: wrap;
- }
- .column {
- flex: 0 0 50%; /* 每个元素占据50%的宽度 */
- max-width: 50%;
- padding: 10px;
- box-sizing: border-box;
- position: relative;
- }
- .item {
- background-color: #f0f0f0;
- padding: 20px;
- margin-bottom: 10px;
- }
- .divider {
- position: absolute;
- top: 0;
- bottom: 0;
- width: 1px; /* 分割线的宽度 */
- background-color: #ccc; /* 分割线的颜色 */
- margin-left: -10px;
- }
- </style>
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。 |