孤独狂饮Test_VUE

本脚本自带 VUE 和 element-ui 属性,可以更方便的添加各种功能。

目前为 2018-07-19 提交的版本,查看 最新版本

// ==UserScript==
// @name         孤独狂饮Test_VUE
// @namespace    [url=mailto:[email protected]][email protected][/url]
// @version      0.1
// @description  本脚本自带 VUE 和 element-ui 属性,可以更方便的添加各种功能。
// @author       gdky005
// @match        *://www.80s.tw/*
// @require      https://unpkg.com/vue/dist/vue.js
// @require      https://unpkg.com/element-ui/lib/index.js
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...

    var header_link = '<link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">';

    //将以上拼接的html代码插入到网页里的ul标签中
    var header_link_tag = $("head");
    if (header_link_tag) {
       header_link_tag.append(header_link);
    }


    var vue_code = '<div id="app">{{ message }}<el-button @click="visible = true">Button</el-button></div>'
    var ul_tag = $("div.info>h1");
    if (ul_tag) {
       ul_tag.append(vue_code);
    };


    new Vue({
        el: '#app',
        data: function () {
            return {
                message: "WangQing",
                visible: false
            }
        }
    })

    //var down_btn_html = '<button>订阅</button>';
    //将以上拼接的html代码插入到网页里的ul标签中
    //var ul_tag = $("div.info>h1");
    //if (ul_tag) {
     //   ul_tag.append(down_btn_html);
    //};
})();