0.0.6 • Published 11 months ago

feg-vuebase v0.0.6

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

Vue3项目基础库

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

已有组件

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

Vue项目引用方式(html)

如需同时引用旧版的 jqueryzepto,需将vuebase.js引用位置在后面

    <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对象函数参考下面说明
browser浏览器相关信息与操作Object对象函数参考下面说明
include加载文件操作相关Object对象函数参考下面说明

函数事件(events)

名称功能说明参数
require加载vue3组件modules : String|String[] // 模块名/列表 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?: number | Date; domain?: string; secure?: boolean; raw?: string;}

storage(events)

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

browser(props)

参数说明类型默认值备注
msie是否IE浏览器Booleanfalse
webkit是否Webkit内核Booleanfalse
pc是否PC端Booleanfalse
mobile是否移动端Booleanfalse
ios是否iosBooleanfalse
android是否androidBooleanfalse
weixin是否微信内Booleanfalse
mini是否小程序内Booleanfalse

browser(events)

名称功能说明参数返回值
query获取URL参数key : String // 参数名 object?: string // 查询对象,默认是location.searchString

include(events)

名称功能说明参数返回值
loadScript加载js远程文件url : String // 参数名 Promise
loadStyles获取URL参数url : String // 参数名

load(props)

参数说明类型默认值备注
startTimewindow load startTimeDate0