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

wx-open-launch

v1.0.1

Published

Vue、React 快速开发库, 微信 H5 跳转小程序,使用 wx-open-launch-weapp 标签; 微信 H5 跳转APP,使用 wx-open-launch-app 标签

Downloads

15

Readme

wx-open-launch

Vue、React 快速开发库

  • 微信 H5 跳转小程序,使用 wx-open-launch-weapp 标签
  • 微信 H5 跳转APP,使用 wx-open-launch-app 标签

npm 安装

npm i wx-open-launch

H5 跳转小程序

HTML:

<view id="launch-btn"></view>

JS/TS:

let weappBtnStyle = `
<style>
	.menu-logo-wx-text {
		font-size: 14px;
		margin-top: 10%;
	}

	.menu-logo-wx {
		height: 30%;
		width: 60%;
	}

	...
</style>
`;
let content = `
<view class="uni-flex-wx uni-column-wx menu-logo-div-wx">
// image src 必须是外网可以访问到的图片,不能填写物理路劲,将无法访问
<image class="menu-logo-wx" src="https://xxxx/xxx/xx.png"></image>
<text class="menu-logo-wx-text">网校</text>
</view>
${weappBtnStyle}
`;

let launchParams = {
	eleId: "launch-btn", // 页面元素标签ID,必填
	url: "", // 小程序地址,非必填
	username: "gh_xxxxxxxxxx", // 小程序原始ID,必填
	content: content, // 按钮HTML元素及样式,必填
	launchEvent: function(e) {...}, // 点击按钮正常跳转触发,必填
	errorEvent: function(e) {...}, // 点击跳转抛出异常,必填
	active: true, // 按钮是否激活跳转小程序,为了满足个别情况下改按钮不需要跳转小程序
	noAtiveEvent: function() {...} // 按钮不跳转小程序时的点击事件,active 为 false 时必填
};
launchWeApp(launchParams); // 引入JS之后调用launchWeApp

H5 跳转APP

HTML:

<view id="launch-btn"></view>

JS/TS:

let weappBtnStyle = `
<style>
	.menu-logo-wx-text {
		font-size: 14px;
		margin-top: 10%;
	}

	.menu-logo-wx {
		height: 30%;
		width: 60%;
	}

	...
</style>
`;
let content = `
<view class="uni-flex-wx uni-column-wx menu-logo-div-wx">
// image src 必须是外网可以访问到的图片,不能填写物理路劲,将无法访问
<image class="menu-logo-wx" src="https://xxxx/xxx/xx.png"></image>
<text class="menu-logo-wx-text">网校</text>
</view>
${weappBtnStyle}
`;

let launchParams = {
	eleId: "launch-btn", // 页面元素标签ID,必填
	appid: "", // 所需跳转的AppID,必填
	extinfo: "", // 跳转所需额外信息,非必填
	content: content, // 按钮HTML元素及样式,必填
	launchEvent: function(e) {...}, // 点击按钮正常跳转触发,必填
	errorEvent: function(e) {...}, // 点击跳转抛出异常,必填
	active: true, // 按钮是否激活跳转APP,为了满足个别情况下改按钮不需要跳转APP
	noAtiveEvent: function() {...} // 按钮不跳转APP时的点击事件,active 为 false 时必填
};
launchApp(launchParams); // 引入JS之后调用launchApp