Showing
2 changed files
with
126 additions
and
9 deletions
| ... | @@ -7,19 +7,10 @@ export {} | ... | @@ -7,19 +7,10 @@ export {} |
| 7 | /* prettier-ignore */ | 7 | /* prettier-ignore */ |
| 8 | declare module 'vue' { | 8 | declare module 'vue' { |
| 9 | export interface GlobalComponents { | 9 | export interface GlobalComponents { |
| 10 | - ElBreadcrumb: typeof import('element-ui/lib/breadcrumb')['default'] | ||
| 11 | - ElBreadcrumbItem: typeof import('element-ui/lib/breadcrumb-item')['default'] | ||
| 12 | - ElCarousel: typeof import('element-ui/lib/carousel')['default'] | ||
| 13 | - ElCarouselItem: typeof import('element-ui/lib/carousel-item')['default'] | ||
| 14 | ElCol: typeof import('element-ui/lib/col')['default'] | 10 | ElCol: typeof import('element-ui/lib/col')['default'] |
| 15 | - ElCollapse: typeof import('element-ui/lib/collapse')['default'] | ||
| 16 | - ElCollapseItem: typeof import('element-ui/lib/collapse-item')['default'] | ||
| 17 | ElCollapseTransition: typeof import('element-ui/lib/transitions/collapse-transition')['default'] | 11 | ElCollapseTransition: typeof import('element-ui/lib/transitions/collapse-transition')['default'] |
| 18 | ElImage: typeof import('element-ui/lib/image')['default'] | 12 | ElImage: typeof import('element-ui/lib/image')['default'] |
| 19 | - ElInput: typeof import('element-ui/lib/input')['default'] | ||
| 20 | - ElOption: typeof import('element-ui/lib/option')['default'] | ||
| 21 | ElRow: typeof import('element-ui/lib/row')['default'] | 13 | ElRow: typeof import('element-ui/lib/row')['default'] |
| 22 | - ElSelect: typeof import('element-ui/lib/select')['default'] | ||
| 23 | ElTooltip: typeof import('element-ui/lib/tooltip')['default'] | 14 | ElTooltip: typeof import('element-ui/lib/tooltip')['default'] |
| 24 | HagerBox: typeof import('./src/components/common/hagerBox.vue')['default'] | 15 | HagerBox: typeof import('./src/components/common/hagerBox.vue')['default'] |
| 25 | HagerCarousel: typeof import('./src/components/hagerCarousel.vue')['default'] | 16 | HagerCarousel: typeof import('./src/components/hagerCarousel.vue')['default'] |
| ... | @@ -27,6 +18,7 @@ declare module 'vue' { | ... | @@ -27,6 +18,7 @@ declare module 'vue' { |
| 27 | HagerH1: typeof import('./src/components/common/hagerH1.vue')['default'] | 18 | HagerH1: typeof import('./src/components/common/hagerH1.vue')['default'] |
| 28 | HagerHCarousel: typeof import('./src/components/hagerHCarousel.vue')['default'] | 19 | HagerHCarousel: typeof import('./src/components/hagerHCarousel.vue')['default'] |
| 29 | HagerHeader: typeof import('./src/components/common/hagerHeader.vue')['default'] | 20 | HagerHeader: typeof import('./src/components/common/hagerHeader.vue')['default'] |
| 21 | + HagerInput: typeof import('./src/components/common/hagerInput.vue')['default'] | ||
| 30 | HagerMenu: typeof import('./src/components/hagerMenu.vue')['default'] | 22 | HagerMenu: typeof import('./src/components/hagerMenu.vue')['default'] |
| 31 | HagerMore: typeof import('./src/components/hagerMore.vue')['default'] | 23 | HagerMore: typeof import('./src/components/hagerMore.vue')['default'] |
| 32 | HagerService: typeof import('./src/components/common/hagerService.vue')['default'] | 24 | HagerService: typeof import('./src/components/common/hagerService.vue')['default'] | ... | ... |
src/components/common/hagerInput.vue
0 → 100644
| 1 | +<!-- | ||
| 2 | + * @Date: 2024-10-20 09:59:52 | ||
| 3 | + * @LastEditors: hookehuyr hookehuyr@gmail.com | ||
| 4 | + * @LastEditTime: 2024-10-20 11:22:12 | ||
| 5 | + * @FilePath: /hager/src/components/common/hagerInput.vue | ||
| 6 | + * @Description: 文件描述 | ||
| 7 | +--> | ||
| 8 | +<template> | ||
| 9 | + <div :class="['hager-input-page', required ? 'required': 'normal']"> | ||
| 10 | + <div :class="['input-box', disable ? 'disable': '']"> | ||
| 11 | + <div class="typeIcon" :style="{backgroundImage: 'url('+typeIcon+')'}"></div> | ||
| 12 | + <input :value="value" @input="onInput" :disabled="disable" :placeholder="placeholder" /> | ||
| 13 | + </div> | ||
| 14 | + </div> | ||
| 15 | +</template> | ||
| 16 | + | ||
| 17 | +<script> | ||
| 18 | +import mixin from 'common/mixin'; | ||
| 19 | + | ||
| 20 | +export default { | ||
| 21 | + mixins: [mixin.init], | ||
| 22 | + props: { | ||
| 23 | + value: { | ||
| 24 | + type: String, | ||
| 25 | + default: '' | ||
| 26 | + }, | ||
| 27 | + placeholder: { | ||
| 28 | + type: String, | ||
| 29 | + default: '请输入内容' | ||
| 30 | + }, | ||
| 31 | + type: { | ||
| 32 | + type: String, | ||
| 33 | + default: 'email' | ||
| 34 | + }, | ||
| 35 | + required: { | ||
| 36 | + type: Boolean, | ||
| 37 | + default: false | ||
| 38 | + }, | ||
| 39 | + disable: { | ||
| 40 | + type: Boolean, | ||
| 41 | + default: false | ||
| 42 | + } | ||
| 43 | + }, | ||
| 44 | + data () { | ||
| 45 | + return { | ||
| 46 | + | ||
| 47 | + } | ||
| 48 | + }, | ||
| 49 | + computed: { | ||
| 50 | + typeIcon () { | ||
| 51 | + switch (this.type) { | ||
| 52 | + case 'email': | ||
| 53 | + return 'https://cdn.ipadbiz.cn/hager/icon/input/%E9%82%AE%E7%AE%B1@2x.png'; | ||
| 54 | + case 'pwd': | ||
| 55 | + return 'https://cdn.ipadbiz.cn/hager/icon/input/%E5%AF%86%E7%A0%81@2x.png'; | ||
| 56 | + case 'username': | ||
| 57 | + return 'https://cdn.ipadbiz.cn/hager/icon/input/%E5%A7%93%E5%90%8D@2x.png'; | ||
| 58 | + case 'tel': | ||
| 59 | + return 'https://cdn.ipadbiz.cn/hager/icon/input/%E7%94%B5%E8%AF%9D@2x.png'; | ||
| 60 | + case 'corp': | ||
| 61 | + return 'https://cdn.ipadbiz.cn/hager/icon/input/%E5%85%AC%E5%8F%B8@2x.png'; | ||
| 62 | + case 'department': | ||
| 63 | + return 'https://cdn.ipadbiz.cn/hager/icon/input/%E8%81%8C%E4%BD%8D@2x.png'; | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + }, | ||
| 67 | + mounted () { | ||
| 68 | + | ||
| 69 | + }, | ||
| 70 | + methods: { | ||
| 71 | + // 当输入框内容发生变化时,触发父组件的 `input` 事件 | ||
| 72 | + onInput(event) { | ||
| 73 | + // 使用 $emit 触发 input 事件,传递新的输入值 | ||
| 74 | + this.$emit('input', event.target.value); | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | +} | ||
| 78 | +</script> | ||
| 79 | + | ||
| 80 | +<style lang="less" scoped> | ||
| 81 | + .hager-input-page { | ||
| 82 | + display: flex; | ||
| 83 | + align-items: center; | ||
| 84 | + &.required::before { | ||
| 85 | + content: '*'; | ||
| 86 | + color: #FF0000; | ||
| 87 | + margin-right: 0.5rem; | ||
| 88 | + } | ||
| 89 | + &.normal { | ||
| 90 | + margin-left: 1rem; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + .input-box { | ||
| 94 | + background: #FFFFFF; | ||
| 95 | + border-radius: 5px; | ||
| 96 | + border: 1px solid #DADADA; | ||
| 97 | + padding: 0.5rem 0.75rem; | ||
| 98 | + width: 100%; | ||
| 99 | + margin: 0.5rem 0; | ||
| 100 | + display: flex; | ||
| 101 | + align-items: center; | ||
| 102 | + justify-content: space-between; | ||
| 103 | + &.disable { | ||
| 104 | + background-color:#F9F9F9; | ||
| 105 | + border: 1px solid #F9F9F9; | ||
| 106 | + input { | ||
| 107 | + background-color:#F9F9F9; | ||
| 108 | + color: #666; | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + .typeIcon { | ||
| 112 | + width: 1rem; | ||
| 113 | + height: 0.9rem; | ||
| 114 | + background-size: contain; | ||
| 115 | + background-repeat: no-repeat; | ||
| 116 | + background-position: center; | ||
| 117 | + margin-right: 0.5rem; | ||
| 118 | + } | ||
| 119 | + input { | ||
| 120 | + border: 0; | ||
| 121 | + width: 100%; | ||
| 122 | + } | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | +</style> |
-
Please register or login to post a comment