|
| 1 | +<template> |
| 2 | + <div class="o-select" :class="className"> |
| 3 | + <label :for="uniqueID">Category</label> |
| 4 | + <div class="o-select-wrapper"> |
| 5 | + <select :name="uniqueID" :id="uniqueID"> |
| 6 | + <option value="">-</option> |
| 7 | + <option value="1">Manufacturing</option> |
| 8 | + <option value="1">Shipping</option> |
| 9 | + <option value="1">Administration</option> |
| 10 | + <option value="1">Human Resources</option> |
| 11 | + </select> |
| 12 | + </div> |
| 13 | + </div> |
| 14 | +</template> |
| 15 | + |
| 16 | +<script lang="ts"> |
| 17 | +import { defineComponent } from "vue"; |
| 18 | +import { genRandomString } from "@/common/tools"; |
| 19 | +
|
| 20 | +export default defineComponent({ |
| 21 | + name: "xxx", // entry u component name |
| 22 | + props: { |
| 23 | + className: { |
| 24 | + type: String, |
| 25 | + require: false, |
| 26 | + }, |
| 27 | + size: { |
| 28 | + type: String, |
| 29 | + require: false, |
| 30 | + default: "middle", // "large" | "middle" | "small" |
| 31 | + }, |
| 32 | + }, |
| 33 | + // setup(props) { |
| 34 | + setup() { |
| 35 | + const uniqueID = `o-select-${genRandomString()}`; |
| 36 | + return { |
| 37 | + uniqueID, |
| 38 | + }; |
| 39 | + }, |
| 40 | +}); |
| 41 | +</script> |
| 42 | + |
| 43 | +<style scoped> |
| 44 | +.o-select { |
| 45 | +} |
| 46 | +.o-select label { |
| 47 | + color: rgba(255, 255, 255, 0.875); |
| 48 | + display: block; |
| 49 | + font-size: 0.8rem; |
| 50 | + font-weight: 700; |
| 51 | + margin: 0 0 0.4875rem 0; |
| 52 | +} |
| 53 | +.o-select-wrapper { |
| 54 | + text-decoration: none; |
| 55 | + display: block; |
| 56 | + position: relative; |
| 57 | +} |
| 58 | +.o-select-wrapper:before { |
| 59 | + display: block; |
| 60 | + content: "\f107"; |
| 61 | + position: absolute; |
| 62 | + top: 0; |
| 63 | + right: 0; |
| 64 | + width: 2.5rem; |
| 65 | + height: 2.5rem; |
| 66 | + line-height: 2.5rem; |
| 67 | + color: rgba(255, 255, 255, 0.75); |
| 68 | + pointer-events: none; |
| 69 | + text-align: center; |
| 70 | + -webkit-font-smoothing: antialiased; |
| 71 | + font-family: FontAwesome; |
| 72 | + font-style: normal; |
| 73 | + font-weight: normal; |
| 74 | + text-transform: none !important; |
| 75 | +} |
| 76 | +.o-select-wrapper select { |
| 77 | + appearance: none; |
| 78 | + background: transparent; |
| 79 | + border: solid 2px rgba(255, 255, 255, 0.25); |
| 80 | + border-radius: 0.25rem; |
| 81 | + display: block; |
| 82 | + outline: 0; |
| 83 | + padding: 0 0.75rem; |
| 84 | + text-decoration: none; |
| 85 | + width: 100%; |
| 86 | + height: 2.5rem; |
| 87 | + color: rgba(255, 255, 255, 0.75); |
| 88 | + font-size: 1rem; |
| 89 | + font-weight: 300; |
| 90 | + line-height: 1.65; |
| 91 | +} |
| 92 | +.o-select-wrapper select:focus { |
| 93 | + border-color: #ffe4b4; |
| 94 | +} |
| 95 | +.o-select-wrapper select option { |
| 96 | + background-color: rgba(255, 255, 255, 0.875); |
| 97 | + color: #2e2b37; |
| 98 | +} |
| 99 | +</style> |
0 commit comments