Greasy Fork is available in English.

vue

vue v3.4.21

이 스크립트는 직접 설치해서 쓰는 게 아닙니다. 다른 스크립트가 메타 명령 // @require https://update.greasyfork.org/scripts/491401/1352637/vue.js(으)로 포함하여 쓰는 라이브러리입니다.

질문, 리뷰하거나, 이 스크립트를 신고하세요.
개발자
zhowiny
버전
v3.4.21
생성
2024-04-01
갱신
2024-04-01
라이선스
MIT

让你可以用Vue畅快的写油猴脚本

如何使用

window.Vue.createApp({template: '<div>{{message}}</div>', setup: () => ({message: 'hello world'})}).mount('body')
// ==UserScript==
// @name         vue example
// @namespace    http://tampermonkey.net/
// @version      2024-04-01
// @description  try to take over the world!
// @author       You
// @match        *
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @require https://update.greasyfork.org/scripts/491401/1352636/vue.js
// @require https://update.greasyfork.org/scripts/491414/1352613/template_vue.js
// ==/UserScript==

const main = () => {
    const {ref} = window.Vue;

    window.TAMPERMONKEY_VUE_APP.template =
        `<div style='display: flex;gap: 4px;'>
        <button @click="count++">{{ count }}</button>
        <button @click="sayHello">say hello</button>
    </div>`;

    window.TAMPERMONKEY_VUE_APP.setup = () => {
        const count = ref(0);
        return {
            count,
            sayHello() {
                console.log('hello')
            }
        }
    }
}

(function() {
    'use strict';
    main();
})();