Coder Social home page Coder Social logo

wux-weapp / wux-weapp Goto Github PK

View Code? Open in Web Editor NEW
5.0K 5.0K 874.0 48.74 MB

:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库

Home Page: https://wuxui.com

License: MIT License

JavaScript 84.97% Smarty 0.02% Shell 0.02% Less 14.99%
bem-css mini-program miniprogram ui-design weapp weapp-demo wechat-weapp weixin wux wux-weapp wuxui wx-component wxapp

wux-weapp's Issues

component的事件调用

Component类的数据是通过加前缀$wux.componentname.examplename插入到Page中的,但是事件是怎么插入我不是很明白, @skyvow 可否说明下,谢谢赐教~

日历组件真机调试模式报错

手机:iOS 11.2.6(15D100)
微信:6.6.5
工具:v1.02.1803210
基础库:1.9.91

复现:

  • wux 日历 demo 模拟器正常,远程调试正常,真机正常,但真机预览开启调试模式时报错;
  • 真机预览开启调试后,默认与多选点击报错无法弹出,单选可弹出但选中日期报错;
  • 错误提示:JSON.stringify cannot serialize cyclic structures.

calendar bug

image
calendar组件逻辑有问题,运行源代码,显示如上图,主要调整下面地方,已可正常运行
updateMonths(offset, update) {
if (!update) {
return false
}

	if (offset === `next`) {
		// const next = this._data.months[this._data.months.length - 1]
		// const nextDateTime = this.getNextDateTime(next.year, next.month)
        const currentYear = this._data.currentYear
        const currentMonth = this._data.currentMonth
		const currentDateTime = new Date(currentYear, currentMonth)
        const prevMonthHTML = this.monthHTML(currentDateTime, `prev`)
        const currentMonthHTML = this.monthHTML(currentDateTime)
        const nextMonthHTML = this.monthHTML(currentDateTime, `next`)
		// this._data.months.splice(0, 1)
		// this._data.months.push(nextMonthHTML)
        this._data.months = [prevMonthHTML, currentMonthHTML, nextMonthHTML]
	}

	if (offset === `prev`) {
		// const prev = this._data.months[0]
		// const prevDateTime = this.getPrevDateTime(prev.year, prev.month)
        const currentYear = this._data.currentYear
        const currentMonth = this._data.currentMonth
		const currentDateTime = new Date(currentYear, currentMonth-2)
        const prevMonthHTML = this.monthHTML(currentDateTime, `prev`)
        const currentMonthHTML = this.monthHTML(currentDateTime)
        const nextMonthHTML = this.monthHTML(currentDateTime, `next`)
		// this._data.months.splice(this._data.months.length - 1, 1)
		// this._data.months.unshift(prevMonthHTML)
        this._data.months = [prevMonthHTML, currentMonthHTML, nextMonthHTML]
	}
}

不是issue

你做的 这个组件,效果很漂亮。大赞,帮了我这个后端大忙。

通常,这个时候,会有一个但是。。。
但是,编程风格上面,我这个后端程序员就很痛苦了。。而且文档说明也不多,幸好有很多例子,而且还是特新潮的 ES6 的 例子。。老人家看起来很累啊,很累啊,很累啊,很累啊。。

地址选择器默认地址传值无效

$wuxPickerCity.init('city', {
			title: '请选择目的地', 
			value: [18, 4, 4],
		    onChange(p) {
		    	console.log(p)
				this.setData({
					city: p.value
				})
			},
		})

不管传什么值都是默认第一个

关于dialog.prompt取值问题。

我不知道为什么dialog.prompt取值要使用
that.data.$wux.dialog.prompt.response
这样长串的方法,是有特殊应用需求吗?

qrcode

请问QRCODE模块,为什么开发者工具重新编译就报错,关闭项目重新打开又正常?

rater评分组件如何获取当前的评分值呢?

rater组件的rater.js文件中:
/**

  • 点击触发事件
    */
    bindtap(e) {
    const i = e.currentTarget.dataset.index
    const rater = this.page.data.$wux.rater[id]
    const value = rater.value
    const disabled = rater.disabled

      			if (disabled) return !1
    
      			if (value === i + 1) {
      				this.page.setData({
      					[`$wux.rater.${id}.value`]: i
      				})
      			} else {
      				this.page.setData({
      					[`$wux.rater.${id}.value`]: i + 1
      				})
      			}
    
      			that.updateStyle(id, this.page)
      			that.updateValue(id, this.page)
    
      			typeof options.callback === `function` && options.callback(e)
      		}
    

上面代码中,评分回调函数options.callback(e)的参数e好像并没有带上用户选中评分的value,请问是我理解有误还是有其他方式来获得当前用户选中的评分值,谢谢:)

Filterbar模拟器下,过滤条件画面切换radiobutton的选项的时候出item.children.map is not a function 错误,但是真机下可以

多次new Component实例的问题

showToast() {
this.$wuxToast.show({
type: 'success',
timer: 1500,
color: '#fff',
text: '已完成',
success: () => console.log('已完成')
})
},
showToastCancel() {
this.$wuxToast.show({
type: 'cancel',
timer: 1500,
color: '#fff',
text: '取消操作',
success: () => console.log('取消操作')
})
}

比如pages里面的toast示例,其实每次show都会new一个component实例,从性能上考虑有木有更好的办法?:)

refresher有明显的卡顿问题,下拉刷新不能自动消失

iPhone 6sp 真机

js:

// pages/notifications/notifications.js
import { $wuxRefresher } from '../../dist/components/wux'

Page({
    data: {
        items: [
            {
                user_name: 'Hzzone',
                pic_url: 'http://tuchuang-1252747889.cosgz.myqcloud.com/2018-03-23-01.png',
                time: new Date().toLocaleString(),
                content: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。',
            },
            {

                user_name: 'Hzzone',
                pic_url: 'http://tuchuang-1252747889.cosgz.myqcloud.com/2018-03-23-01.png',
                time: new Date().toLocaleString(),
                content: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。',
            }
        ],
    },
    onLoad() {
        this.refresher = new $wuxRefresher({
            onPulling() {
                console.log('onPulling')
            },
            onRefresh() {
                console.log('onRefresh')
                // 刷新时调用
                setTimeout(() => {
                    const items = this.scope.data.items

                    items.unshift({

                        user_name: 'Hzzone',
                        pic_url: 'http://tuchuang-1252747889.cosgz.myqcloud.com/2018-03-23-01.png',
                        time: new Date().toLocaleString(),
                        content: '由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。由各种物质组成的巨型球状天体,叫做星球。星球有一定的形状,有自己的运行轨道。',
                    })

                    this.scope.setData({
                        items: items,
                    })

                    this.events.emit(`scroll.refreshComplete`)
                }, 1000)
            }
        })
        console.log(this.refresher)
    },
    touchstart(e) {
        this.refresher.touchstart(e)
    },
    touchmove(e) {
        this.refresher.touchmove(e)
    },
    touchend(e) {
        this.refresher.touchend(e)
    },
})

html:

<!--pages/notifications/notifications.wxml-->
<import src="../../dist/components/refresher/refresher.wxml"/>

<view class="container" style="position: absolute; height: 100%; {{ $wux.refresher.style }}" bindtouchstart="touchstart" bindtouchmove="touchmove" bindtouchend="touchend">
	<template is="refresher" data="{{ ...$wux.refresher }}"/>
	<view class="weui-panel weui-panel_access">
        <view class="weui-panel__hd">消息列表</view>
        <view class="weui-panel__bd">
            <navigator wx:for="{{ items }}" wx:key="" url='/pages/notification_detail/notification_detail?user_name={{item.user_name}}&time={{item.time}}&content={{item.content}}&pic={{item.pic_url}}'>
            <view class="weui-media-box weui-media-box_text">
                <view class='user_info'>
                    <image src='{{item.pic_url}}'></image>
                    <view>{{ item.user_name }}</view>
                </view>
                <view class='notification_info'>
                        <view class="time">{{ item.time }}</view>                     
                 <view class="weui-media-box__desc">{{ item.content }}</view>  
                </view>
                
            </view>
            </navigator>
            
        </view>
    </view>
</view>

css:

/* pages/notifications/notifications.wxss */
.weui-media-box {
    padding: 10rpx;
}

.weui-media-box image {
    height: 120rpx;
    width: 120rpx;
    padding: 10rpx;
}

.weui-media-box.weui-media-box_text {
    display: flex;
}

.title {
    display: row;
}

.user_info {
    font-size: 30rpx;
    text-align: center;
    display: flex;
    flex-direction: column;
}

.time {
    margin: 10rpx;
    color: black; 
    font-size: 35rpx;
}
.notification_info .weui-media-box__desc{
    margin: 10rpx;
    height: 110rpx;
    -webkit-line-clamp: 3;
}

.weui-panel.weui-panel_access {
    overflow: visible;
}
.container {
    display: block;
}

关于倒计时传入动态数据

// date: +(new Date) + 24 * 60 * 60 * 1000,
直接传入数值可以倒计时
date: that.c3Date,
传入自定义的动态数据,实际倒计时时的数值还是js封装类里面定义的默认值,进行倒计时。
怎样修改封装的类

调用遇到问题

image

我在项目中调用的时候报错了, 改成 -> onConfirm: function(e) { 这样可以

筛选框点击空白处,筛选消失

您好,我看了您最近的更新,将筛选框点击空白处的事件绑定到onConfirm(e)事件上了,这样的话,点击空白处等同于点击确定。我觉得这样用户体验不是很好,因为点击空白一般发生在误点筛选,或者点击筛选之后发现没有需要的筛选项,只是简单的关闭筛选框而已。
建议将此时间单独绑定一下。
我按照我的需求新建了一个方法,components/filterbar/filterbar.js第60行后增加以下代码
/** * 点击空白筛选框消失 * @param {Object} e 事件对象 */ filterHide(e) { const { index } = e.currentTarget.dataset this.setData({ [$wux.filterbar.items[${index}].visible]: false, }) },
在components/filterbar/filterbar.wxml第12行改为以下
<view class="wux-backdrop {{ animateCss }}" hidden="{{ !item.visible }}" wx:if="{{ item.type === 'filter' }}" data-index="{{ index }}" bindtap="{{filterHide}}"></view>

报错 firstRender not the data from Page.data

$wui.xxx.yyy这类都是onload之后才挂到Page的data上的,所以页面初始化时候没有这类数据
<template data="...$wui.xxx.yyy"就报错

目前只找到笨办法手动提前设置好

Page({
  data: {
    $wui: { xxx: { yyy: [] } }
  }
})

宝宝

嘤嘤 拿小拳拳锤你胸口

建议:筛选框点击空白处,弹出部分可以关闭

点击筛选之后,scroll-view打开,但是要关闭这个页面,需要点击下面确认才能关闭,如果点击左边空白的地方能关闭就好了,同样的,顶部的那一排,点击空白的地方也能自己关闭就好了

gallery component does not support wxfile url

gallery 组件采用background的形式来展示图片,而目前微信background 不支持 wxfile://tmp_1432973527o6zAJs9mBPbqQXsTYTB65vWW18sU5cdb0c6f3ac57085fd7a0f027cd51fe5.jpg这样的本地路径(这是iOS 10选区的本地图片的路径)。

dialog组件出现点击穿透问题

模拟器没问题,真机上如果页面中有input、textarea组件,弹出dialog会出现点击穿透的问题,placehodel的内容会悬浮到dialog上面
mmexport1501771989538

浮动按钮在苹果真机上无显示

在安卓机上就正常,苹果手机用的是5S, 10.3系统,只试用了一下浮动按钮,其它组件未知。

另外无法在目前的开发工具预览你的工程(原打算在苹果机上测试其它组件是否正常)。

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.