ui: fix eslint errors

This commit is contained in:
liushuyu 2021-03-21 21:59:28 -06:00
parent a9de893cca
commit df0414b26e
No known key found for this signature in database
GPG Key ID: 23D1CE4534419437
3 changed files with 15 additions and 14 deletions

View File

@ -24,7 +24,7 @@ export const i18n = new VueI18n({
// Borrowed from http://tobyho.com/2012/07/27/taking-over-console-log/ // Borrowed from http://tobyho.com/2012/07/27/taking-over-console-log/
function intercept (method) { function intercept (method) {
console[method] = function () { console[method] = function () {
var message = Array.prototype.slice.apply(arguments).join(' ') const message = Array.prototype.slice.apply(arguments).join(' ')
window.external.invoke( window.external.invoke(
JSON.stringify({ JSON.stringify({
Log: { Log: {
@ -37,7 +37,7 @@ function intercept (method) {
} }
// See if we have access to the JSON interface // See if we have access to the JSON interface
var hasExternalInterface = false let hasExternalInterface = false
try { try {
window.external.invoke(JSON.stringify({ window.external.invoke(JSON.stringify({
Test: {} Test: {}
@ -60,8 +60,8 @@ if (hasExternalInterface) {
) )
} }
var methods = ['log', 'warn', 'error'] const methods = ['log', 'warn', 'error']
for (var i = 0; i < methods.length; i++) { for (let i = 0; i < methods.length; i++) {
intercept(methods[i]) intercept(methods[i])
} }
} }
@ -97,7 +97,7 @@ function selectFileCallback (name) {
window.selectFileCallback = selectFileCallback window.selectFileCallback = selectFileCallback
var app = new Vue({ const app = new Vue({
i18n: i18n, i18n: i18n,
router: router, router: router,
data: { data: {
@ -125,7 +125,8 @@ var app = new Vue({
methods: { methods: {
exit: function () { exit: function () {
axios.get('/api/exit').catch(function (msg) { axios.get('/api/exit').catch(function (msg) {
var searchLocation = (app.metadata.install_path && app.metadata.install_path.length > 0) ? app.metadata.install_path const searchLocation = (app.metadata.install_path && app.metadata.install_path.length > 0)
? app.metadata.install_path
: i18n.t('error.location_unknown') : i18n.t('error.location_unknown')
app.$router.replace({ app.$router.replace({

View File

@ -39,13 +39,13 @@ export default {
}, },
methods: { methods: {
install: function () { install: function () {
var that = this const that = this
var app = this.$root const app = this.$root
var results = {} const results = {}
for (var package_index = 0; package_index < app.config.packages.length; package_index++) { for (let package_index = 0; package_index < app.config.packages.length; package_index++) {
var current_package = app.config.packages[package_index] const current_package = app.config.packages[package_index]
if (current_package.default != null) { if (current_package.default != null) {
results[current_package.name] = current_package.default results[current_package.name] = current_package.default
} }
@ -57,7 +57,7 @@ export default {
results.mode = 'force' results.mode = 'force'
} }
var targetUrl = '/api/start-install' let targetUrl = '/api/start-install'
if (this.is_uninstall) { if (this.is_uninstall) {
targetUrl = '/api/uninstall' targetUrl = '/api/uninstall'
} }

View File

@ -116,9 +116,9 @@ export default {
this.$router.push('/install/regular') this.$router.push('/install/regular')
return return
} }
var my = this const my = this
this.$http.post('/api/verify-path', `path=${this.$root.$data.install_location}`).then(function (resp) { this.$http.post('/api/verify-path', `path=${this.$root.$data.install_location}`).then(function (resp) {
var data = resp.data || {} const data = resp.data || {}
if (!data.exists) { if (!data.exists) {
my.$router.push('/install/regular') my.$router.push('/install/regular')
} else { } else {