monkey-box

A simple ui framework for monkey script

Version vom 02.06.2018. Aktuellste Version

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/368779/602186/monkey-box.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

Autor
bramblex
Version
0.0.1
Erstellt am
30.05.2018
Letzte Aktualisierung
02.06.2018
Größe
6,87 KB
Lizenz
MIT

MonkeyBox

基于 vue 的简易有猴子 ui 框架

使用方法

  1. 首先创建一个油猴子脚本,并且添加如下代码进入 metadata
// @require https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.16/vue.min.js
// @require https://greasyfork.org/scripts/368779-monkey-box/code/monkey-box.js
  1. MonkeyBox.addBox(id: string, vue: VueComponet) 在 MonkeyBox 里添加组件
MonkeyBox.addBox('hellobox', {
    // 自动保存 data (可选)
    autosave: 'local' | 'global' ,

    // 自动转换成带 scope 的css (可选)
    style: `
        button {
            color: red;
        }
    `,

    // vue 模板
    template: '<button @click="sayHello">{{ text }}</button>', 

    // 数据模型
    data: {
        msg: 'hello'
    },

    // 定义方法
    methods: {
        sayHello() {
            alert('hello')
        },

        testApi() {
        // 绑在 vm 中的 API
            this.loadGlobalData()
            this.loadLocalData()
            this.saveGlobalData(data)
            this.saveLocalData(data)
            this.clearLocalData()
            this.clearGlobalData()
        }
    }

})