添加多个符号
This commit is contained in:
parent
f25164e2e0
commit
babb1fc3b6
@ -69,7 +69,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import prompt from '@blueos.window.prompt';
|
||||
export default {
|
||||
data: {
|
||||
fromPageData: null, //转跳输入法前的页面的要保存的数据(转跳页面时传过来一个对象,输入完成后传回去)
|
||||
@ -79,6 +78,7 @@ export default {
|
||||
sindex: 0, //键盘滑动位置,实现从候选页返回时可以返回到原页面
|
||||
mode: "cn", //输入模式标记,中文cn,英文en,符号数字标记
|
||||
caps: -1, //大小写标记
|
||||
symbolToggle:-1,
|
||||
row1Letters: ["Q","W","E","R","T","Y","U","I","O","P"],
|
||||
row2Letters: ["A","S","D","F","G","H","J","K","L"],
|
||||
row3Letters: ["Z","X","C","V","B","N","M"],
|
||||
@ -94,10 +94,19 @@ export default {
|
||||
row3: ["z", "x", "c", "v", "b", "n", "m"]
|
||||
},
|
||||
sy: {
|
||||
row1: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||
row2: ["!", "@", "#", "%", "&", "*", "(", ")",","],
|
||||
row3: ["_", "=", "{", "}", "[", "]","。"]
|
||||
}
|
||||
// 默认符号组(较少的符号,保持布局一致)
|
||||
default: {
|
||||
row1: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "0"],
|
||||
row2: ["!", "@", "#", "%", "&", "*", "(", ")", ","],
|
||||
row3: ["_", "=", "{", "}", "[", "]", "。"]
|
||||
},
|
||||
// 补充符号组(额外的符号)
|
||||
alternate: {
|
||||
row1: ["~", "`", "©", "®", "±", "÷", "×", "/", "\\", "∞"],
|
||||
row2: ["♥", "♦", "♣", "♠", "•", "$", "|", "^", "-"],
|
||||
row3: ["¿", "¡", "∑", "∏", "π", "Ω", "∆"]
|
||||
}
|
||||
}
|
||||
},
|
||||
currentWords: [], // 当前显示的候选词
|
||||
wordsPageIndex: 0, // 候选词页码
|
||||
@ -129,12 +138,31 @@ export default {
|
||||
|
||||
this.currentWords = candidates.slice(this.wordsPageIndex, this.wordsPageIndex + 5);
|
||||
},
|
||||
changeToSymbol() {
|
||||
changeToSymbol() {
|
||||
// 如果当前已经是符号模式,则切换符号组
|
||||
if (this.mode === 'sy') {
|
||||
// 切换开关状态
|
||||
this.symbolToggle = !this.symbolToggle;
|
||||
if (this.symbolToggle) {
|
||||
// 切换到备用符号组
|
||||
this.row1Letters = this.keyboardModes.sy.alternate.row1;
|
||||
this.row2Letters = this.keyboardModes.sy.alternate.row2;
|
||||
this.row3Letters = this.keyboardModes.sy.alternate.row3;
|
||||
} else {
|
||||
// 切换回默认符号组
|
||||
this.row1Letters = this.keyboardModes.sy.default.row1;
|
||||
this.row2Letters = this.keyboardModes.sy.default.row2;
|
||||
this.row3Letters = this.keyboardModes.sy.default.row3;
|
||||
}
|
||||
} else {
|
||||
// 不是符号模式时,切换到符号模式,默认使用默认符号组
|
||||
this.mode = 'sy';
|
||||
this.row1Letters = this.keyboardModes.sy.row1;
|
||||
this.row2Letters = this.keyboardModes.sy.row2;
|
||||
this.row3Letters = this.keyboardModes.sy.row3;
|
||||
},
|
||||
this.symbolToggle = false; // 重置切换标志
|
||||
this.row1Letters = this.keyboardModes.sy.default.row1;
|
||||
this.row2Letters = this.keyboardModes.sy.default.row2;
|
||||
this.row3Letters = this.keyboardModes.sy.default.row3;
|
||||
}
|
||||
},
|
||||
changeToEn() {
|
||||
if (this.mode === 'en') {
|
||||
this.caps = this.caps === 1 ? -1 : 1;
|
||||
@ -231,12 +259,6 @@ export default {
|
||||
jumpToCandidate() {
|
||||
this.sindex = 1;
|
||||
},
|
||||
finishInput() {
|
||||
prompt.showToast({
|
||||
message: '输入完成,此处可以storage保存或params然后跳转到你的页面',
|
||||
})
|
||||
},
|
||||
|
||||
touchMove(e) { // swipe处理事件
|
||||
if (e.direction == "right") { // 右滑退出
|
||||
this.cancel_input()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user