This repository has been archived by the owner on May 20, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: switch mode and some commponent
- Loading branch information
Showing
20 changed files
with
542 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/target | ||
.idea | ||
.vscode/ | ||
node_modules | ||
node_modules | ||
dist |
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,58 @@ | ||
<script setup lang="ts"> | ||
// This starter template is using Vue 3 <script setup> SFCs | ||
// Check out https://vuejs.org/api/sfc-script-setup.html#script-setup | ||
import Translation from "./components/Translation.vue"; | ||
import { reactive, provide, watchEffect } from 'vue' | ||
import Translation from "./components/translation.vue"; | ||
import Nav from "./components/Nav.vue"; | ||
import Set from "./components/Set.vue"; | ||
import { KeyInfo, Platform } from "./types/type"; | ||
const plat = reactive({ | ||
current: Platform.YouDao, | ||
}); | ||
const takes = reactive({ | ||
isTakes: false, | ||
}); | ||
const keyList = reactive<KeyInfo>({ | ||
google: { | ||
platform: "Google Key", | ||
key: "", | ||
}, | ||
youdao: { | ||
platform: "youdao Key", | ||
key: "", | ||
} | ||
}) | ||
const model = reactive({ | ||
currentModel: 1, | ||
}); | ||
const showSetPage = reactive({ | ||
show: false, | ||
}); | ||
// watchEffect(()=>{ | ||
// console.log(takes.isTakes); | ||
// }); | ||
provide("plat", plat); | ||
provide("model", model); | ||
</script> | ||
|
||
<template> | ||
<div class="header"> | ||
<Nav :plat = plat :takes= takes :showSetPage="showSetPage"/> | ||
</div> | ||
<div class="container"> | ||
<Translation /> | ||
</div> | ||
<div class="setting" v-if="showSetPage.show"> | ||
<Set :keyList="keyList" :model="model"/> | ||
</div> | ||
</template> | ||
|
||
<style scoped></style> | ||
<style scoped> | ||
.setting { | ||
position: absolute; | ||
right: 0; | ||
top: 50px; | ||
} | ||
</style> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<script setup lang="ts"> | ||
import {IconSettings, IconBrandGoogle, IconBrandBing, IconBrandNeteaseMusic} from "@tabler/icons-vue"; | ||
import Button from "./common/Button.vue"; | ||
import { Platform } from "../types/type"; | ||
import { ref } from "vue"; | ||
const props = defineProps<{ | ||
plat: { | ||
current: Platform | ||
}, | ||
takes: { | ||
isTakes: boolean, | ||
}, | ||
showSetPage: { | ||
show: boolean, | ||
}, | ||
}>(); | ||
const click = (plat: Platform) => { | ||
props.plat.current = plat; | ||
}; | ||
const isTakes = () => { | ||
props.takes.isTakes = !props.takes.isTakes; | ||
}; | ||
const color = ref("white"); | ||
const show = () => { | ||
props.showSetPage.show = !props.showSetPage.show; | ||
if (props.showSetPage.show) { | ||
color.value = "skyblue"; | ||
} else { | ||
color.value = "white"; | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="nav"> | ||
<div class="btns"> | ||
<Button class="btn" :class="{ active: plat.current === Platform.YouDao }" @click="click(Platform.YouDao)"> | ||
<IconBrandNeteaseMusic :size="16" color="red"></IconBrandNeteaseMusic> | ||
有道词典 | ||
</Button> | ||
<Button class="btn" :class="{ active: plat.current === Platform.Bing }" @click="click(Platform.Bing)"> | ||
<IconBrandBing :size="16" color="skyblue"></IconBrandBing> | ||
bing | ||
</Button> | ||
<Button class="btn" :class="{ active: plat.current === Platform.Google }" @click="click(Platform.Google)"> | ||
<IconBrandGoogle :size="16" color="skyblue"></IconBrandGoogle> | ||
</Button> | ||
</div> | ||
<div class="setting"> | ||
<div class="takes"> | ||
<input type="checkbox" name="takes" id="takes" @change="isTakes()"> | ||
<label for="takes">划屏取词</label> | ||
</div> | ||
<IconSettings :color="color" @click="show"></IconSettings> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.nav { | ||
display: flex; | ||
justify-content: space-between; | ||
align-items: center; | ||
width: 100%; | ||
height: 50px; | ||
/* background-color: #fff; */ | ||
border-bottom: 1px solid #ccc; | ||
} | ||
.nav .btns { | ||
display: flex; | ||
} | ||
.active { | ||
background-color: rgb(91, 77, 77); | ||
} | ||
.btns .btn { | ||
margin: 5px; | ||
flex: 1; | ||
} | ||
.nav .setting { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
width: 25%; | ||
cursor: pointer; | ||
} | ||
.setting .takes { | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
padding: 4px; | ||
margin-right: 8px; | ||
font-size: 14px; | ||
} | ||
.takes > input { | ||
width: 15px; | ||
height: 15px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<script lang="ts" setup> | ||
import { ref } from "vue"; | ||
import { KeyInfo } from "../types/type"; | ||
import Input from "./common/Input.vue"; | ||
const props = defineProps<{ | ||
keyList: KeyInfo, | ||
model: { | ||
currentModel: number, | ||
}, | ||
}>(); | ||
</script> | ||
|
||
<template> | ||
<div class="set"> | ||
<div class="model"> | ||
选择模式: | ||
<select name="" id="" v-model="props.model.currentModel"> | ||
<option :value="1">模式一</option> | ||
<option :value="2">模式二</option> | ||
</select> | ||
</div> | ||
<Input v-for="item in props.keyList" :platform="item.platform" v-model="item.key"></Input> | ||
</div> | ||
</template> | ||
|
||
<style scoped> | ||
.set { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: start; | ||
align-items: start; | ||
width: 400px; | ||
height: calc(100% - 50px); | ||
padding: 8px; | ||
background-color: #1d1d1d; | ||
box-shadow: 1px 4px 10px rgba(255, 255, 255, 0.6); | ||
} | ||
.model { | ||
margin: 8px; | ||
} | ||
.model > select { | ||
width: 100px; | ||
height: 30px; | ||
margin: 8px; | ||
font-size: 16px; | ||
background-color: #1d1d1d; | ||
color: #fff; | ||
} | ||
</style> |
Oops, something went wrong.