1 Star 2 Fork 0

小巷 / x-uni

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

http/service 请求服务

  • lib/config.js 配置文件

service目录下为所有请求相关文件

  • http.js 基础请求封装,挂载为 $http
  • demo.js 为了复制用的
  • goods.service.js封装服务,在main.js中挂载,需带$来区分

xuni 通用组件包安装

xuni/xuni-components-bag 是整个通用组件包及依赖,其中 xuni-components-bag.vue 是整合包

独立组件放在 xuni/xuni-components 中,需独立引用

z-index 峰值 10000 ,如超过此数,则可以遮盖所有通用组件

static中有x-uni静态文件要记得带着

非weex使用

//main.js添加引用
//通用组件包
import xuniComponentsBag from './xuni/xuni-components-bag'
//挂载通用组件包
Vue.component('xuni-components-bag', xuniComponentsBag);

//然后每个页面仅需要添加
<xuni-components-bag ref="xuni"></xuni-components-bag>

weex使用

//每个页面都需要常规引用
<xuni-components-bag ref="xuni"></xuni-components-bag>
import xuniComponentsBag from '@/xuni/xuni-components-bag';
components:{
	xuniComponentsBag
}

注意!!!

  • 页面onLoad中无法调用,需在onReady/mounted挂载完成后方可调用
  • 建议使用onReady监听页面初次渲染完成,onLoad中组件未挂载完成,无法调用。注意如果渲染速度快,会在页面进入动画完成前触发

xuni 组件包 api文档

bag组件参数功能

<xuni-components-bag 
	ref="xuni"
	
	:showStatusBar="true"   //APP沉浸式状态栏占位,微信小程序不生效(不需要)
	:statusBarColor="'#0000ff'"  //APP沉浸式状态栏占位颜色
	
	:showBackBtn="true"   //显示悬浮返回按钮,微信小程序不生效(不需要)
	:whiteBackBtn="true"  //悬浮返回按钮白色风格,默认黑色
	:backDelta="4"        //返回按钮后退页数
	
></xuni-components-bag>

加载提示 显示/隐藏

this.$refs.xuni.showLoading(); 
this.$refs.xuni.hideLoading(); 

轻提示

this.$refs.xuni.showToast({
	msg:'hello!!',         //必填
	style:'white/black',   //默认black
	times:5000             //自动关闭时间,毫秒,默认3秒
});

顶部提示 显示/隐藏

this.$refs.xuni.showTopMsg({
	msg: 'hello!',   //提示内容,必填
	times:2000,      //自动关闭时间,毫秒,不填需用户点击遮罩关闭
	status: true     //默认false(不增加状态栏高度),如果是沉浸式页面,需要填true来增加顶部状态栏占位
});
	
this.$refs.xuni.hideTopMsg();

alert/confirm

this.$refs.xuni.confirm({
	msg: '提示内容',  //必填,与image字段互斥,image字段优先级高
	image: 'url',   //如果填写,则msg不会被显示
	confirmColor: '#ff5656',  //确认按钮文本颜色,默认 #000
	confirmText: '知道了',    //确认按钮文本,默认 “确定”
	showCancel: true,        //显示取消按钮,默认 false
	cancelColor: '#0800ff',  //取消按钮文本颜色,默认 #888
	cancelText: '稍后再说',  //取消按钮文本,默认 “取消”
	success: res => {       //按钮点击回调
		if (res.confirm) {
			this.$refs.xuni.showToast({
				msg: '确定触发'
			});
		} else {
			this.$refs.xuni.showToast({
				msg: '取消触发',
				style: 'white'
			});
		}
	}
});
MIT License Copyright (c) 2019 小巷 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

基于uni-app的常用封装,包括请求与组件,兼容H5、APP、Weex、微信小程序 展开 收起
JavaScript
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
JavaScript
1
https://gitee.com/xianglikai1/x-uni.git
git@gitee.com:xianglikai1/x-uni.git
xianglikai1
x-uni
x-uni
master

搜索帮助