0.0.3 • Published 3 months ago

feg-vuebase v0.0.3

Weekly downloads
-
License
-
Repository
-
Last release
3 months ago

Vue3项目基础库

基于Vue3项目的基础库,目前包含 组件加载器 和 组件描述声明文件

已有组件

名称模块名功能说明
一键启动nie.vue3.gamestartVue3的游戏一键启动组件
版权nie.vue3.copyrightVue3的版权组件,兼容PC和移动

Vue项目引用方式(html)

    <script src="https://nie.res.netease.com/comm/js/vuebase.js"></script>

TypeScript声明文件引用

    // vite-env.d.ts
    // 顶部 vite 下 引入下面这句

    /// <reference types="feg-vuebase/client" />

全局方式

    //main.ts

    Promise.all([import("vue"),import("axios"),import("axios-jsonp")]).then(async (rets)=>{
        
        [window.Vue, window.axios, window.axiosJsonpAdapter] = rets;

        const [GameStart,CopyRight] = await VueBase.require(["nie.vue3.gamestart","nie.vue3.copyright"]);

        app.use(GameStart);
        app.use(CopyRight);

        app.mount("#app");
    });
    <template>
        <feg-gamestart product="yys"></feg-gamestart>
        <feg-copyright product="yys"></feg-copyright>
    </template>

局部方式(不推荐)

    //main.ts

    Promise.all([import("vue"),import("axios"),import("axios-jsonp")]).then((rets)=>{
        
        [window.Vue, window.axios, window.axiosJsonpAdapter] = rets;

        app.mount("#app");
    });
    <template>
        <component :is="GameStart" product="yys"></component>
    </template>
    <script lang="ts" setup>

        const GameStart = ref(null);

        const loadComponents = async ()=>{

            GameStart.value = await VueBase.require("nie.vue3.gamestart",true);
        }
        loadComponents();
    </script>

API

属性(props)

参数说明类型默认值备注
isHomeDomain是否国内域名Boolean
report章鱼统计相关Object对象函数参考下面说明
cookiecookie操作相关Object对象函数参考下面说明
storagelocalstorage操作相关Object对象函数参考下面说明

函数事件(events)

名称功能说明参数
require加载vue3组件modules : StringString[] // 模块名/列表 isRaw : boolean // 是否为局部组件加载

report(events)

名称功能说明参数
clickStat打点统计上报params : { activity : String ; // 页面地址 monitor : String ; // 上报关键字 desc : String ; // 关键字中文描述}
add兼容旧版章鱼的点击统计monitor : String // 点击统计名称 desc : String // 统计描述

cookie(events)

名称功能说明参数
get获取cookiename : String // cookie名
set设置cookiename : String // cookie名 value : String // cookie值 options?: { path?: string; expires?: numberDate; domain?: string; secure?: boolean; raw?: string;}

storage(events)

名称功能说明参数
get获取localstoragename : String // storage名
set设置localstoragename : String // storage名 value : String // storage值