Code Monkey home page Code Monkey logo

pt_jssdk's Introduction

pt_jssdk

葡萄纬度SDK

注. 使用sdk,需要在url上加上参数inapp=1

Web端使用方式:

Installation

在页面中引入pt_jssdk_v1.0.2.js

example

pt_jssdk.openWebView({
  url:'...',
  title:'...'
})

API

viewPics

预览图片
参数名称 类型 说明
titlestring每张图片的title
picListarray 图片列表
注:>item
>> arry中的每个图片项,类型为object
>>> url ,类型为string
>>> text, 类型为string
例: [
{
url:'http://xxxxxxxxxxx/example.jpg',
text:'test title'
}
]
clickIndexnumber当前点击浏览的图片的索引,默认为0

openWebView

打开一个webview
参数名称 类型 说明
titlestring页面的title
urlstring打开页面的url地址
idstring文章id(非必须)

pageSetting

设置原页面生标题和分享第三方的配置数据等
参数名称 类型 说明
titlestring页面的title
picstring分享出去的icon图片
urlstring打开页面的url地址
idstring文章id(非必须)

webViewBack

webview返回打开他的APP页 (用于整页都是web,包括顶部头部的web页)
参数名称 类型 说明
namestring返回到指定的原生view的name (不传,则返回默认的前一个打开的view)
urlstring打开页面的url地址
idstring文章id(非必须)

openOriginalArticle

阅读原文
参数名称 类型 说明
urlstring原文地址
titlestring文章的title
idstring文章id(非必须)

openNativeView

打开原生view
参数名称 类型 说明
typestring需要打开的view的类型,比如:打开专题还是产品详情
titlestring文章的title
idstring打开页面需要的id

nativeShare

   调用原生分享功能

       
参数名称 类型 说明
titlestring分享的title
picstring分享出去的icon图片
descstring分享的简介文字
urlstring分享的页面地址

客户端主动与web前端交互的使用方法

1.前端开发者,通过pt_jssdk.on(type,callback),来订阅一个事件,
  一个参数为自定义的事件名,callback是回调函数,接收一个参数,类型为 object
2.客户端直接调用pt_dispatch(type,data) 方法,
type:类型string,跟web前端开发者约定好的的事件名,data为需要传递给前端的数据

pt_jssdk's People

Contributors

juhuaxia avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.