1.1.8 • Published 4 years ago
sg-native v1.1.8
sg-native-uhome
安装依赖
npm install
运行项目
npm run serve
打包项目
npm run build
打包发布至npm
npm run lib
npm login
npm publish
测试
npm run test
项目使用sg-native协议方 安装依赖
npm install sg-native --save
入口文件引入
import SgNative from 'sg-native'
Vue.use(SgNative)
四格api
this.$mapi.api.returnNative() 返回原生
this.$mapi.api.getUserInfo(params, cb) 获取用户信息
this.$mapi.api.camera(params, cb) 调用相机
this.$mapi.api.weChatPay(params, cb) 微信支付
this.$mapi.api.share(params, cb) 分享
this.$mapi.api.scanQrCode(params, cb) 扫描
this.$mapi.api.signature(params, cb) 签名
utils基础工具方法
loadScript(url) 异步加载js
使用
mapi.utiles.loadScript(url).then()
协议插件扩展
安装基础插件 npm install sg-native --save
使用基础插件 Vue.use(SgNative)
编写插件方法
// 插件初始化,如加载原生协议等
install () {}
// 环境对象
env {
// 当前环境名字
name: 'uhome',
// 当前环境判断
judge: {
name: 'isUhome',
fn () {
// 判断当前环境函数
return /uhome/i.test(navigator.userAgent.toLowerCase())
}
},
// 环境变量字段扩展
ext: {
}
}
api {
// 此处添加原生方法
}
utils {
// 扩展工具方法
}
导入插件
import SgNative from 'sg-native'
import SgNativeMidea from 'sg-native-midea'
Vue.use(SgNative)
SgNative.use(SgNativeMidea)
Customize configuration
1.1.8
4 years ago
1.1.7
4 years ago
1.1.6
4 years ago
1.1.5
4 years ago
1.1.4
4 years ago
1.1.3
4 years ago
1.1.2
4 years ago
1.1.1
4 years ago
1.1.0
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago
1.0.6
4 years ago
1.0.5
4 years ago
1.0.4
4 years ago
1.0.3
4 years ago
1.0.2
4 years ago
1.0.1
4 years ago
1.0.0
4 years ago