0.1.46 • Published 1 month ago

popup-supwisdom v0.1.46

Weekly downloads
-
License
ISC
Repository
-
Last release
1 month ago

popup.js

一款弹框浮层的插件

已默认自动识别三端,为了防止识别无效,支持自定义设置当前所在端

集成方式1: npm安装

    npm i popup-supwisdom --save
    
    import('popup-supwisdom/popup.css')
    var EvaPopup = require('popup-supwisdom/popup.js')

集成方式2: cdn引入

evaluation-center.dev2.supwisdom.com 按照各个学校的实际路径地址调整

    <!-- 引入样式 -->
    <link rel="stylesheet" href="http://evaluation-center.dev2.supwisdom.com/eva-plugin/popup.css">
    <!-- 引入组件库 -->
    <script src="http://evaluation-center.dev2.supwisdom.com/eva-plugin/popup.js"></script>

最简用法示例

evaluation-center.dev2.supwisdom.com 按照各个学校的实际路径地址调整

    new EvaPopup({
        objKey: '2323', // 对象key 必传
        token: '', // token值 必传
        requestUrl: 'https://evaluation-center.dev2.supwisdom.com', // 评价中台服务url 必传
        userAgent: 'pc', // 系统自动获取所在端,支持自定义当前所在端 参数app,pc,wx 非必传,不传根据当前页面的userAgent判断
    })

完整用法示例

evaluation-center.dev2.supwisdom.com 按照各个学校的实际路径地址调整

    var pop = new EvaPopup({
        objKey: '2323', // 对象key 必传
        token: '', // token值 必传
        requestUrl: 'https://evaluation-center.dev2.supwisdom.com', // 评价中台服务url 必传
        userAgent: 'pc', // 系统自动获取所在端,支持自定义当前所在端 参数app,pc,wx 非必传,不传根据当前页面的userAgent判断
        title: '',  // 支持自定义传标题 非必传,不传则取document.getElementsByTagName('title')[0].innerText
        url: '', // 支持自定义传所在页面的url 非必传,不传则取location.href
        answers: function () {
            console.log('点击 "小希问答" 按钮时的回调,可不定义')
        },
        evaluation: function () {
            console.log('点击 "服务评价" 按钮时的回调,可不定义')
        },
        feedback: function () {
            console.log('点击 "咨询反馈" 按钮时的回调,可不定义')
        }
    })
// 监听事件
pop.on('answers', function () {
    console.log('点击 "小希问答" 按钮时的监听,可不定义')
})
pop.on('evaluation', function () {
    console.log('点击 "服务评价" 按钮时的监听,可不定义')
})
pop.on('feedback', function () {
    console.log('点击 "咨询反馈" 按钮时的监听,可不定义')
})
### API
#### Props
|  参数   | 说明  | 类型  | 默认值 | 可选值 | 是否必填|
|  ----  | ----  | ---- | ---- | ---- | ---- |
| objKey  | 对象key | String  | ' '  | -  | 是  |
| token  | token值 | String  | ' '  | -  | 是  |
| requestUrl  | 评价中台服务url | String  | ' '  | -  | 是  |
| userAgent  | 系统自动获取所在端,支持自定义当前所在端 参数 非必传 | -  | 系统自动获取  | app,pc,wx  | 否  |
| title  | 自定义标题 | String  |  当前页面的title | -  | 否  |
| url  | 自定义传所在页面的url | String  |  当前页面的url | -  | 否  |

#### Events

|  事件名   | 说明  | 回调函数 |
|  ----  | ----  | ----  |
| answers  | 点击问答时触发	 | - |
| evaluation  | 点击评价时触发	 | - |
| feedback  | 点击咨询反馈时触发	 | - |
0.1.45

1 month ago

0.1.46

1 month ago

0.1.44

2 months ago

0.1.43

2 years ago

0.1.42

2 years ago

0.1.41

2 years ago

0.1.32

2 years ago

0.1.33

2 years ago

0.1.34

2 years ago

0.1.35

2 years ago

0.1.36

2 years ago

0.1.37

2 years ago

0.1.40

2 years ago

0.1.38

2 years ago

0.1.39

2 years ago

0.1.31

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago