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

View File

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

View File

@ -6,6 +6,7 @@
<script lang="ts">
import { defineComponent } from "vue";
import { BrowserOpenURL } from "../../../../../wailsjs/runtime";
export default defineComponent({
name: "OpenLink",
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.
// 使aGo使
window.runtime.BrowserOpenURL(props.href);
BrowserOpenURL(props.href);
};
return {

View File

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