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 🙏

© 2025 – Pkg Stats / Ryan Hefner

fs-alipay-ad-component-test

v0.1.1

Published

支付宝小程序广告组件

Downloads

46

Readme

fs-alipay-ad-component 支付宝广告组件

使用前准备

request合法域名 中增加如下配置

https://advertising.adcomeon.com
https://fshows-ecs-pro.cn-hangzhou.log.aliyuncs.com

使用方法

一. npm 安装

npm install fs-alipay-ad-component --save

二. 使用

  1. 开发者工具中启用component2 tip
  2. 引入组件,页面的 json 文件中做如下配置
{
  "usingComponents": {
    "fs-ad": "fs-alipay-ad-component"
  }
}
  1. 页面的 axml 文件
<fs-ad
  a:if="{{showFsAd}}"
  ref="fsAd"
  flowMasterId="xxx"
  openId="xxx"
  onAdInfoReady="handleOpenAd"
/>

注意

  • 如果在新开页面接入组件,需要添加onAdInfoReady属性,用于获取到广告后立即展示广告。
  • 如果组件接在支付页,支付完成后不跳页面,那么不需要写onAdInfoReady,只需要在支付完成的回调中去调用handleOpenAd方法即可。
  1. 页面的js文件,展示广告

注意:showFsAd在data中的初始值应设置为false

Page({
  data: {
    showFsAd: false // showFsAd在data中的初始值应设置为false
  },
  onLoad () { // 获取广告
    this.setData({
      showFsAd: true
    })
  },
  fsAd (ref) {
    this.fsAdRef = ref // 通过ref获取广告方法
  },
  /**
   * @function 展示广告
   */
  handleOpenAd () {
    this.fsAdRef.showAd()
  }
})

三. 参数说明

| 变量 | 类型 | 必填 | 说明 | |:----|:----:|:----:|:----| | openId | String | 是 | 用户 openId | | flowMasterId | String | 是 | 流量位标识, 运营提供的字段 |

四.事件

| 事件名称 | 参数 | 必填 | 说明 | |:----|:----:|:----:|:----| | onAdInfoReady | 无 | 否 | 广告数据获取成功的回调函数 |

Tips

  1. 如果你的必传参数中,有异步获取的,请通过a:if,在获取参数后再进行组件的一个显示,以防提示缺少必传参数