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

uniapp-uview-components

v1.4.3

Published

基于uview的uniapp组建

Downloads

185

Readme

uniapp-uview-components 基于uview的unaiapp二次封装项目(目前主要适配微信小程序)

更新日志

2023/9/7 at 20:43 on [email protected]

  • 添加$requirePrivacyAuthorize主动触发授权事件,对于需要授权的页面未添加授权组件时输出提示消息
  • 添加专属icon配置文件

使用前置工作!!!

安装 uview-ui

npm install uview-ui

安装 uniapp-uview-components

npm install uniapp-uview-components

main.js 引入

import uView from "uview-ui";
import uniappUviewComponents from "uniapp-uview-components";
Vue.use(uView);
Vue.use(uniappUviewComponents)

uni.scss 引入

    @import 'uview-ui/theme.scss';

App.vue 引入

<style lang="scss">
    /* 注意style标签加入lang="scss"属性*/
    /*
        没有scss的看下面操作
        安装sass sass-loader,注意sass-loader需要版本10,否则可能会导致vue与sass的兼容问题而报错
        npm i sass sass-loader@10 -D
     */
    @import "uview-ui/index.scss";
    @import "uniapp-uview-components/index.scss";

</style>

vue.config.js 配置

// vue.config.js,如没有此文件则手动创建
module.exports = {
    transpileDependencies: ["uview-ui","uniapp-uview-components"]
}

page.json 配置

"easycom":{
    "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue",
    "^view-(.*)": "uniapp-uview-components/components/view-$1/view-$1.vue"
}

API

使用微信隐私政策相关组件在2023/9/15号之前需要添加以下配置

uniapp中 -> manifest.json -> "mp-weixin"

"mp-weixin": {
    /* 添加以下配置 */
    "__usePrivacyCheck__": true,
},

usePrivacyCheck 开启后。使用对应的接口时需要在微信后台更新对应的接口隐私说明,不存在该接口隐私说明的可能无反应或报错

view-agree-privacy 隐私政策组件

props

| 属性 | 类型 | 默认值 | 说明 | |---------------------------|---------|----------------------------------------------------------------------|------------------------------------------| | title | String | 隐私政策概要 | 标题当设置title时autoTitle不生效 | | autoTitle | boolean | false | 是否自动设置标题 默认false | | subTitle | String | 亲爱的用户,感谢您一直以来的支持!为了更好地保护您的权益,同时遵守相关监管要求,请认真阅读《xxx小程序隐私保护指引》,特向您说明如下: | 副标题 | | agreePrivacyId | String | agree-btn | (可不配置)按钮id 当指定权限按钮id时要与该id对应 | | disableCheckPrivacy | boolean | false | 禁止自动检测隐私 |

events

| 事件 | 参数 | 说明 | |--------------------------|--------------------------|-------------------------------------| | agree | buttonId | 用户点击同意事件 buttonId同意按钮的id | | disagree | 无 | 用户点击拒绝事件 | | needPrivacyAuthorization | resolve, eventInfo | 当触发微信onNeedPrivacyAuthorization回调事件 |

用法

<template>
  <view>
    <!--  引入隐私组件  -->
    <view-agree-privacy @agree="agree" @disagree="disagree" @needPrivacyAuthorization="needPrivacyAuthorization"></view-agree-privacy>
    <u-button @getphonenumber="getphonenumber" open-type="getPhoneNumber"  text="获取手机号"></u-button>
    <u-button @click="test" text="主动触发隐私弹框"></u-button>
  </view>
</template>

<script>

  export default {
    data() {
      return {
        title: 'Hello'
      }
    },
    methods: {
      //主动触发隐私弹框
      test(){
        this.$requirePrivacyAuthorize({
          success:(res)=>{
            //同意
            console.log("success",res)
          },
          fail:(res)=>{
            //拒绝
            console.log("fail",res)
          },
          complete:(res)=>{
          }
        })
      },

      //触发授权回调
      needPrivacyAuthorization( resolve, eventInfo){
        console.log('触发本次事件的接口是:' + eventInfo.referrer)
      },
      // 同意
      agree(buttonId){
        console.log("buttonId", buttonId)
        console.log(".....agree")
      },
      // 不同意
      disagree(){
        console.log(".....disagree")
      },

      getphonenumber(e){
        console.log("e",e)
      }
    }
  }
</script>

<style>

</style>

view-main 根组件

该组件一般用于根组件(后续会在该组件放入一些公共方法以方便调用)

目前该组件内包含 view-agree-privacy 用法与其组件相同

props

| 属性 | 类型 | 说明 | |---------------------|--------|----------------------------------------| | agreePrivacyConfig | Object | 用于配置隐私弹框 详情预览view-agree-privacy组件props |

events

| 事件 | 参数 | 说明 | |--------------------------|--------------------|-------------------------------------| | agree | buttonId | 用户点击同意事件 buttonId同意按钮的id | | disagree | 无 | 用户点击拒绝事件 | | needPrivacyAuthorization | resolve, eventInfo | 当触发微信onNeedPrivacyAuthorization回调事件 |

用法

<template>
  <view>
    <view-main :agreePrivacyConfig="{title:'隐私保护政策说明'}" @agree="agree" @disagree="disagree" @needPrivacyAuthorization="needPrivacyAuthorization">
      <u-button  @getphonenumber="getphonenumber" open-type="getPhoneNumber"  text="获取手机号"></u-button>
    </view-main>
  </view>
</template>

<script>


  export default {
    data() {
      return {
        title: 'Hello'
      }
    },
    onLoad() {

    },
    methods: {
      getphonenumber(e){
        console.log("e",e)
      },
      needPrivacyAuthorization( resolve, eventInfo){
        console.log('触发本次事件的接口是:' + eventInfo.referrer)
      },
      agree(){
        console.log(".....agree")
      },
      disagree(){
        console.log(".....disagree")
      }
    }
  }
</script>

<style>

</style>

slot

| 属性 | 类型 | 说明 | |---------------------|--------|----------------------------------------| | default | slot | 主要用于存放子标签 |

view-card 卡片组件

| 属性 | 类型 | 默认值 | 说明 | |-----------|---------|--------|----------------| | show | boolean | true | 是否显示 | | cardCss | String | | 卡片的css | | styleBody | String | | 自定义slot中的style | | bg | String | white | 卡片背景色 | | minHeight | String | | 卡片最小高度 | | cardData | {} | | 卡片携带的数据 | | url | String | | 卡片点击跳转的链接 | | titleCss | String | | 卡片顶部css | | title | String | | 卡片title css | | border | boolean | false | 边框 |