Skip to content

Commit

Permalink
Update to vue3
Browse files Browse the repository at this point in the history
  • Loading branch information
brychanrobot committed Sep 24, 2020
1 parent ae5b24b commit 49f9d56
Show file tree
Hide file tree
Showing 24 changed files with 375 additions and 283 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports = {
node: true
},
extends: [
"plugin:vue/essential",
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended",
"@vue/prettier",
Expand Down
1 change: 1 addition & 0 deletions .firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
index.html,1600741975410,72c9d554db6ecbba22a5e4d142435d34981c6595cd5dcaefaf5d681968078422
6 changes: 3 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
6 changes: 3 additions & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
"ndarray": "^1.0.19",
"ndarray-show": "^2.0.0",
"register-service-worker": "^1.7.1",
"vue": "^2.6.11",
"vue-class-component": "^7.2.3",
"vue-property-decorator": "^8.4.2",
"vue-router": "^3.2.0",
"vuex": "^3.4.0",
"vue": "^3.0.0-0",
"vue-class-component": "^8.0.0-0",
"vue-router": "^4.0.0-0",
"vuex": "^4.0.0-0",
"webgl-plot": "^0.5.1"
},
"devDependencies": {
Expand All @@ -37,17 +36,17 @@
"@vue/cli-plugin-unit-jest": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0-0",
"@vue/eslint-config-prettier": "^6.0.0",
"@vue/eslint-config-typescript": "^5.0.2",
"@vue/test-utils": "^1.0.3",
"@vue/test-utils": "^2.0.0-alpha.1",
"eslint": "^6.7.2",
"eslint-plugin-prettier": "^3.1.3",
"eslint-plugin-vue": "^6.2.2",
"eslint-plugin-vue": "^7.0.0-0",
"file-loader": "^6.1.0",
"prettier": "^1.19.1",
"sass": "^1.26.5",
"sass-loader": "^8.0.2",
"typescript": "~3.9.3",
"vue-template-compiler": "^2.6.11"
"typescript": "~3.9.3"
}
}
38 changes: 19 additions & 19 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<!--
Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<template>
<div id="app">
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view />
<div id="nav">
<router-link to="/">Home</router-link> |
<router-link to="/about">About</router-link>
</div>
<router-view />
</template>

<style lang="scss">
Expand Down
44 changes: 25 additions & 19 deletions src/components/HelloWorld.vue
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<!--
Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

<template>
<div class="hello">
Expand All @@ -21,8 +23,8 @@
</template>

<script lang="ts">
import { Options, Vue } from "vue-class-component";
import WebGLplot, { WebglLine, ColorRGBA } from "webgl-plot";
import { Component, Prop, Vue } from "vue-property-decorator";
import {
Owon,
Voltage,
Expand All @@ -35,14 +37,18 @@ import {
TriggerSlope
} from "../driver/owon";

@Component
@Options({
props: {
msg: String
}
})
export default class HelloWorld extends Vue {
@Prop() private msg!: string;
msg!: string;
private ch1Line_?: WebglLine;
private timeIndex_ = 0;
private chart_?: WebGLplot;

private mounted() {
private onMounted() {
const chartCanvas = this.$refs.chart as HTMLCanvasElement;
const devicePixelRatio = window.devicePixelRatio || 1;
chartCanvas.width = chartCanvas.clientWidth * devicePixelRatio;
Expand Down Expand Up @@ -86,7 +92,7 @@ export default class HelloWorld extends Vue {
mode: TriggerMode.SINGLE,
slope: TriggerSlope.RISING,
holdoffSeconds: 0.001,
triggerLevel: 36,
triggerLevel: 36
});

console.log("configure timebase");
Expand Down Expand Up @@ -114,7 +120,7 @@ export default class HelloWorld extends Vue {
const channel = dataView.getUint8(0);
console.log("gotData: ", channel, dataView);
const multiplier = 1 / 3096.0;
const floatData= new Float32Array(1275);
const floatData = new Float32Array(1275);
try {
for (
let byteIndex = 11 + 100, timeIndex = 0;
Expand Down
8 changes: 4 additions & 4 deletions src/driver/owon.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -656,4 +656,4 @@ export class Owon {
static getFilter(): Partial<USBRequestFilter> {
return { vendorId: 0x5345, productId: 0x1234 };
}
}
}
19 changes: 8 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Vue from "vue";
import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
import router from "./router";
import store from "./store";

Vue.config.productionTip = false;

new Vue({
router,
store,
render: h => h(App)
}).$mount("#app");
createApp(App)
.use(store)
.use(router)
.mount("#app");
6 changes: 3 additions & 3 deletions src/registerServiceWorker.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down
18 changes: 7 additions & 11 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Vue from "vue";
import VueRouter, { RouteConfig } from "vue-router";
import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home.vue";

Vue.use(VueRouter);

const routes: Array<RouteConfig> = [
const routes: Array<RouteRecordRaw> = [
{
path: "/",
name: "Home",
Expand All @@ -35,9 +32,8 @@ const routes: Array<RouteConfig> = [
}
];

const router = new VueRouter({
mode: "history",
base: process.env.BASE_URL,
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
});

Expand Down
27 changes: 0 additions & 27 deletions src/shims-tsx.d.ts

This file was deleted.

11 changes: 6 additions & 5 deletions src/shims-vue.d.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
// Copyright 2020 Google LLC
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

declare module "*.vue" {
import Vue from "vue";
export default Vue;
import { defineComponent } from "vue";
const component: ReturnType<typeof defineComponent>;
export default component;
}
Loading

0 comments on commit 49f9d56

Please sign in to comment.