integrated vue code into old js codebase;removed auto self-refreshing

This commit is contained in:
huangjx
2021-10-21 18:33:19 +08:00
parent 5037180a40
commit 2d23090055
6 changed files with 59 additions and 23 deletions

View File

@@ -1,14 +1,13 @@
import helper from './helper'
import $ from 'jquery'
import Http from './http'
//import actionLinks from './actionLinks'
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
import inputAction from './inputAction'
import updatePage from './updatePage'
import buttonActions from './buttonActions'
import inputBox from './inputBox'
import './css/style.scss'
import './css/table.scss'
import { createApp } from 'vue'
import App from './App';
'use strict'
const basePath = "/apps/ncdownloader";
@@ -21,11 +20,14 @@ $(document).on('ajaxSend', function (elm, xhr, settings) {
})
window.addEventListener('DOMContentLoaded', function () {
inputAction.run();
// inputAction.run();
updatePage.run();
buttonActions.run();
let container = 'ncdownloader-form-container';
let app = createApp(App);
let vm = app.mount('#' + container);
helper.addVue(vm.$options.name, vm);
$("#ncdownloader-form-wrapper").append(inputBox.getInstance(t("ncdownloader", 'New Download')).create());
$("#start-aria2").on("click", function (e) {
const path = basePath + "/aria2/start";
let url = helper.generateUrl(path);
@@ -39,6 +41,10 @@ window.addEventListener('DOMContentLoaded', function () {
window.location.href = link;
})
$("#app-navigation").on("click", "#search-download", helper.showDownload);
});