UNPKG

chinese-keyboard.js

Version:

中文键盘:支持VUE2、VUE3、REACT、以及原生JS

178 lines (157 loc) 3.07 kB
/* 中文虚拟键盘样式 - 中国红主题 */ .chinese-keyboard { position: fixed; bottom: 0; left: 0; right: 0; background: #d32f2f; border-top: 1px solid #8d0000; box-shadow: 0 -2px 10px rgba(139, 0, 0, 0.1); z-index: 9999; max-width: 100vw; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; } /* 候选字区域 */ .candidate-area { background: #fff3e0; border-bottom: 1px solid #ff8f00; padding: 8px; min-height: 40px; overflow-y: auto; } .pinyin-display { font-size: 30px; color: #d32f2f; margin-bottom: 8px; font-weight: 500; } .candidates-container { display: flex; flex-wrap: wrap; margin-bottom: 8px; } .candidate-char { background: #fff3e0; border: 1px solid #ff8f00; border-radius: 6px; padding: 8px 16px; margin-left: 4px; margin-right: 4px; font-size: 30px; color: #d32f2f; cursor: pointer; min-width: 44px; text-align: center; user-select: none; height: 70px; margin-bottom: 8px; } .no-hide { font-size: 30px !important; background: #d32f2f; color: #fff3e0; border: none; border-radius: 50%; width: 52px !important; height: 52px !important; cursor: pointer; display: flex; align-items: center; justify-content: center; } .pagination { display: flex; gap: 8px; justify-content: center; } .pagination button { background: #d32f2f; color: #fff3e0; border: none; border-radius: 50%; width: 32px; height: 32px; cursor: pointer; font-size: 30px; display: flex; align-items: center; justify-content: center; } /* 键盘主体 */ .keyboard-body { padding: 12px 6px; background: #d32f2f; } .keyboard-row { display: flex; justify-content: center; margin-bottom: 8px; } .keyboard-row:last-child { margin-bottom: 0; } /* 按键样式 */ .keyboard-key { margin-left: 3px; margin-right: 3px; background: #fff3e0; border: 1px solid #ff8f00; border-radius: 8px; color: #d32f2f; font-size: 30px; font-weight: 500; cursor: pointer; user-select: none; height: 92px; flex: 1; width: 100px; touch-action: manipulation; min-height: 48px; display: flex; align-items: center; justify-content: center; position: relative; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); } /* 特殊按键样式 */ .keyboard-key--special { background: #d32f2f; color: #fff3e0; border-color: #8d0000; font-weight: 600; } .keyboard-key--none { flex: 1 !important; } /* 空格键特殊样式 */ .keyboard-key--space { background: #fff3e0; color: #fff3e0; border-color: #e65100; } /* 无障碍访问支持 */ .keyboard-key:focus { outline: 2px solid #ff8f00; outline-offset: 2px; } .candidate-char:focus { outline: 2px solid #ff8f00; outline-offset: 2px; } /* 防止文本选择 */ .chinese-keyboard * { -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; } .flex-1-2 { flex: 1.2 !important; } .flex-1-1 { flex: 1.1 !important; } .flex-4 { flex: 4 !important; }