Make TS template in wails beta 35 can be built and run normally (#31)

* Make TS template in wails beta 35 can be built and run normally

* Make TS template in wails beta 35 can be built and run normally2
This commit is contained in:
daoif 2022-05-05 04:19:20 +08:00 committed by GitHub
parent 0b4e6edce5
commit 845e3b0829
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 16 deletions

View File

@ -1,11 +1,10 @@
{ {
"name": "ts", "name": "ts",
"private": true,
"version": "0.1.0", "version": "0.1.0",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build:finally": "vue-tsc --noEmit && vite build --emptyOutDir", "build":"vite build",
"build:dev": "vite build --mode development --emptyOutDir",
"build:dev:watch": "vite build --mode development --watch --emptyOutDir",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
@ -15,7 +14,7 @@
"devDependencies": { "devDependencies": {
"@vitejs/plugin-vue": "^2.3.1", "@vitejs/plugin-vue": "^2.3.1",
"sass": "^1.49.9", "sass": "^1.49.9",
"typescript": "^4.4.4", "typescript": "^4.5.4",
"vite": "^2.9.2", "vite": "^2.9.2",
"vue-tsc": "^0.28.10", "vue-tsc": "^0.28.10",
"vite-plugin-html": "^3.2.0" "vite-plugin-html": "^3.2.0"

View File

@ -12,13 +12,8 @@
<!-- 菜单 --> <!-- 菜单 -->
<div class="menu" data-wails-no-drag> <div class="menu" data-wails-no-drag>
<div class="language"> <div class="language">
<div <div v-for="item in languages" :key="item" :class="{ active: item === locale }"
v-for="item in languages" @click="onclickLanguageHandle(item)" class="lang-item">
:key="item"
:class="{ active: item === locale }"
@click="onclickLanguageHandle(item)"
class="lang-item"
>
{{ t("languages." + item) }} {{ t("languages." + item) }}
</div> </div>
</div> </div>
@ -40,6 +35,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { WindowMinimise, Quit } from "../../../wailsjs/runtime";
export default defineComponent({ export default defineComponent({
setup() { setup() {
@ -55,10 +51,10 @@ export default defineComponent({
}; };
const onclickMinimise = () => { const onclickMinimise = () => {
window.runtime.WindowMinimise(); WindowMinimise();
}; };
const onclickQuit = () => { const onclickQuit = () => {
window.runtime.Quit(); Quit();
}; };
return { return {
@ -81,6 +77,7 @@ html {
width: 100%; width: 100%;
height: 100%; height: 100%;
} }
body { body {
width: 100%; width: 100%;
height: 100%; height: 100%;
@ -98,6 +95,7 @@ body {
background-color: rgba(219, 188, 239, 0.9); background-color: rgba(219, 188, 239, 0.9);
overflow: hidden; overflow: hidden;
} }
.header { .header {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -107,6 +105,7 @@ body {
height: 50px; height: 50px;
padding: 0 10px; padding: 0 10px;
background-color: rgba(171, 126, 220, 0.9); background-color: rgba(171, 126, 220, 0.9);
.nav { .nav {
a { a {
display: inline-block; display: inline-block;
@ -122,6 +121,7 @@ body {
color: #000000; color: #000000;
font-size: 14px; font-size: 14px;
white-space: nowrap; white-space: nowrap;
&:hover, &:hover,
&.router-link-exact-active { &.router-link-exact-active {
background-color: #d7a8d8; background-color: #d7a8d8;
@ -129,17 +129,20 @@ body {
} }
} }
} }
.menu { .menu {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: nowrap; flex-wrap: nowrap;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
.language { .language {
margin-right: 20px; margin-right: 20px;
border-radius: 2px; border-radius: 2px;
background-color: #c3c3c3; background-color: #c3c3c3;
overflow: hidden; overflow: hidden;
.lang-item { .lang-item {
display: inline-block; display: inline-block;
min-width: 50px; min-width: 50px;
@ -151,10 +154,12 @@ body {
text-decoration: none; text-decoration: none;
color: #000000; color: #000000;
font-size: 14px; font-size: 14px;
&:hover { &:hover {
background-color: #ff050542; background-color: #ff050542;
cursor: pointer; cursor: pointer;
} }
&.active { &.active {
background-color: #ff050542; background-color: #ff050542;
color: #ffffff; color: #ffffff;
@ -162,6 +167,7 @@ body {
} }
} }
} }
.bar { .bar {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -169,6 +175,7 @@ body {
align-items: center; align-items: center;
justify-content: flex-end; justify-content: flex-end;
min-width: 150px; min-width: 150px;
.bar-btn { .bar-btn {
display: inline-block; display: inline-block;
min-width: 80px; min-width: 80px;
@ -182,6 +189,7 @@ body {
text-decoration: none; text-decoration: none;
color: #000000; color: #000000;
font-size: 14px; font-size: 14px;
&:hover { &:hover {
background-color: #d7a8d8; background-color: #d7a8d8;
color: #ffffff; color: #ffffff;

View File

@ -6,6 +6,7 @@
<script lang="ts"> <script lang="ts">
import { defineComponent } from "vue"; import { defineComponent } from "vue";
import { BrowserOpenURL } from "../../../../../wailsjs/runtime";
export default defineComponent({ export default defineComponent({
name: "OpenLink", name: "OpenLink",
props: { props: {
@ -16,7 +17,7 @@ export default defineComponent({
// You cannot use the a tag directly, you need to call the Go method here to open the link using the default browser. // You cannot use the a tag directly, you need to call the Go method here to open the link using the default browser.
// 使aGo使 // 使aGo使
window.runtime.BrowserOpenURL(props.href); BrowserOpenURL(props.href);
}; };
return { return {

View File

@ -4,8 +4,7 @@
"assetdir": "frontend/dist", "assetdir": "frontend/dist",
"frontend:install": "npm install", "frontend:install": "npm install",
"frontend:build": "npm run build -w js", "frontend:build": "npm run build -w js",
"frontend:dev": "npm run build:dev -w js", "frontend:dev:watcher": "npm run dev -w js",
"frontend:dev:watcher": "npm run build:dev:watch -w js",
"debounceMS": 1200, "debounceMS": 1200,
"author": { "author": {
"name": "{{.AuthorName}}", "name": "{{.AuthorName}}",