diff options
author | André Jaenisch <Ryuno-Ki@users.noreply.github.com> | 2022-10-01 16:26:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-01 22:26:38 +0800 |
commit | 04e97b83115e7439d43c0ede5fe2d1b50d201c52 (patch) | |
tree | 073a20e9377c5197112327afd11d7a6f2cccb268 /web_src/js/features/contextpopup.js | |
parent | 726afe8a9e33128476e1dc85f262fe56f995d12c (diff) | |
download | gitea-04e97b83115e7439d43c0ede5fe2d1b50d201c52.tar.gz gitea-04e97b83115e7439d43c0ede5fe2d1b50d201c52.zip |
Refactor from Vue2 to Vue3 (#20044)
Close #19902
Diffstat (limited to 'web_src/js/features/contextpopup.js')
-rw-r--r-- | web_src/js/features/contextpopup.js | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/web_src/js/features/contextpopup.js b/web_src/js/features/contextpopup.js index f4e660be3f..d29da6d951 100644 --- a/web_src/js/features/contextpopup.js +++ b/web_src/js/features/contextpopup.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import Vue from 'vue'; +import {createApp} from 'vue'; import ContextPopup from '../components/ContextPopup.vue'; import {parseIssueHref} from '../utils.js'; import {createTippy} from '../modules/tippy.js'; @@ -17,17 +17,12 @@ export default function initContextPopups() { if (!owner) return; const el = document.createElement('div'); - el.innerHTML = '<div></div>'; this.parentNode.insertBefore(el, this.nextSibling); - const View = Vue.extend({ - render: (createElement) => createElement(ContextPopup), - }); - - const view = new View(); + const view = createApp(ContextPopup); try { - view.$mount(el.firstChild); + view.mount(el); } catch (err) { console.error(err); el.textContent = 'ContextPopup failed to load'; @@ -37,7 +32,7 @@ export default function initContextPopups() { content: el, interactive: true, onShow: () => { - view.$emit('load-context-popup', {owner, repo, index}); + el.firstChild.dispatchEvent(new CustomEvent('us-load-context-popup', {detail: {owner, repo, index}})); } }); }); |