npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-jsbridge

v1.1.1

Published

Vue单页框架与Native交互控制器。

Downloads

14

Readme

Vue-jsBridge

Vue单页框架与Native交互控制器。	

Notes:
所有api调用时传入的参数值都必须使用字符串(特别说明的除外)

调用方式

npm install vue-jsbridge

Vue调用方式

var vueBridge = require('vue-jsbridge');

Vue.use(vueBridge);

API

<v-linkurl>

重写vuejs的v-link方法,业务端无需判断环境,直接使用,使用方法和v-link差不多,不过v-linkurl加了一个必传参数

例如:

v-link的用法:

v-linkurl的用法:

其中 title是必传参数 它是作为Native头部的标题栏用, name和url必传其一,name是跳转的hash, url是跳转的url

有url的时候 优先url作为跳转


// v-linkurl 页面间的跳转方法.
// request:示例



<a v-linkurl="{name: 'home', query: {},title: '首页',url: 'http://xxxx'}">首页</a>
<checkInsideApp>

checkInsideApp 判断是否在APP内 全站方法,返回 true 和 false

要求是在所有的H5头部都加上该判断.

//////////
//
// checkInsideApp
//
// request:示例
//
//////////

<header v-if="checkInsideApp">title</header>

console.log(this.checkInsideApp);

<openNewPage>

openNewPage打开新页面,和v-linkurl差不多,考虑到有的地方是@click时间,所以加了这个方法。

//////////
//
// openNewPage打开新页面
//
// request:示例
// {
//       "name": 'home', // hash
//       "title": '首页', // 页面标题
//       "query": {},
//       "url": 'http://xxx'
// }
//
//////////

this.openNewPage({
	name: 'home',
	query: {w:1},
	title: '首页'
})
<showLoadingView>

showLoadingView 加载loadling页面 不在APP内时 返回 true,在APP内会调出APP的loadingView

//////////
//
// showLoadingView打开loading
//
// request:示例
// 
//
//////////

this.showLoadingView();
<hideLoadingView>

hideLoadingView 隐藏loadingView 不在APP返回false

//////////
//
// showLoadingView隐藏loading
//
//
//////////

this.hideLoadingView();
<showLoadingDialog>

showLoadingDialog 加载loadling页面 不在APP内时 返回 true,在APP内会调出APP的loadingView

//////////
//
// showLoadingDialog打开loadingDialog
//
// request:示例
// 
//
//////////

this.showLoadingDialog();
<hideLoadingView>

hideLoadingView 隐藏loadingView 不在APP返回false

//////////
//
// showLoadingDialog隐藏loadingDialog
//
//
//////////

this.showLoadingDialog();
<showToast>

showToast显示toast提示

需要引入css vue-jsbridge.css

//////////
//
// showToast 显示toast提示
//
// request:示例
// {
//         "msg":msg
// }
//
//////////

this.showToast({
	"msg": "showToast"
});
<showAlert>

showAlert 弹出alert提示

需要引入css vue-jsbridge.css

//////////
//
// showAlert 弹出alert提示
//
// title : "title",
// content : "msg",
// button1 : "buttion1Title",
// button1action: function(){},//action支持传scheme或者方法
// button2 : "buttion2Title",
// button2action : function(){},
//
//////////

this.showAlert({
	"title": "提示"
	"msg": "showToast"
});
<gotoLoginPage>

gotoLoginPage 跳转到登录页

//////////
//
// gotoLoginPage 
//
//
//////////

this.gotoLoginPage({
	success: function() {
		// 跳转成功后回调
		...
	}
});
<addIconMenu>

addIconMenu 添加icon menu

//////////
//
// addIconMenu 向头部添加icon Menu.
//
// request:示例
// {
//    iconUrl: "http://....img",
//		rule: {value: ("0" left), ("1", right)},
//		listener: {
//			onSuccess: function(data) {
// 			},
//			onFail: function(data) {
// 			}
// 		}
// }
// 
//////////

this.addIconMenu({
	iconUrl: "http://....img",
	rule: "1"
});
<addWordMenu>

addWordMenu 添加文字 menu

//////////
//
// addWordMenu 向头部添加文字 Menu.
//
// request:示例
// {
//    word: "常见问题",
//		rule: {value: ("0" left), ("1", right)},
//		listener: {
//			onSuccess: function(data) {
// 			},
//			onFail: function(data) {
// 			}
// 		}
// }
// 
//////////

this.addWordMenu({
	word: "常见问题",
	rule: "1",
	listener: {
		onSuccess: function() {
			this.openNewPage({...})
		}
	}
	
});
<addWordMenu>

addShareMenu 添加分享 menu

//////////
//
// addShareMenu 添加分享menu.
//
// request:示例
// {
//    title : '' // 分享标题.
// 		content: '' // 分享内容描述.
//		link: ''  // 分享链接地址.
//		imgLink: // 分享标题图片.
// }
// 
//////////

this.addShareMenu({
	title: '分享',
	content: 'testtestetsteststtetstststetststtettstststetstststt',
	link: window.location.href,
	imgLink: ''
})
<deleteMenu>

deleteMenu 删除 menu

在执行addMenu的时候 先要执行 deleteMenu,这可能是Native 的一个bug.

/////////
//
// 删除左边或者右边的所有的menu
// 
// request {
// 	rule: {value: ("0" left), ("1", right)}
// }
/////////

var _this = this;
_this.deleteMenu({
	rule: "1"
});
_this.addShareMenu({
	title: '分享',
	content: 'testtestetsteststtetstststetststtettstststetstststt',
	link: window.location.href,
	imgLink: ''
});