VUE x Tampermonkey

警告
本文最后更新于 2023-05-22,文中内容可能已过时。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// ==UserScript==
// @name         VUE测试
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://cyan-io.github.io/
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// ==/UserScript==
let script = document.createElement('script');
script.setAttribute('type', 'text/javascript');
script.src = "https://unpkg.com/vue@3/dist/vue.global.js";
document.documentElement.appendChild(script);

const mes=['a','b','c']

window.onload = () => {
    let text = `<div id="app" style="position: fixed;top: 0;left: 0;z-index: 9999;background: #fb7d7d;width: 100px;">
           {{ message }}
    </div>`

    var el = document.createElement('div')
    el.innerHTML = text;
    document.body.append(el)
    const App = {
        data() {
            return {
                message:mes,
            };
        },
    };
    const app = Vue.createApp(App);
    app.mount("#app");
}
0%