wux-weapp / wux-weapp Goto Github PK
View Code? Open in Web Editor NEW:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库
Home Page: https://wuxui.com
License: MIT License
:dog: 一套组件化、可复用、易扩展的微信小程序 UI 组件库
Home Page: https://wuxui.com
License: MIT License
https://github.com/weui/weui-wxss
项目中使用了weui.wxss 与 wux 组件样式名称冲突
Component
类的数据是通过加前缀$wux.componentname.examplename
插入到Page中的,但是事件是怎么插入我不是很明白, @skyvow 可否说明下,谢谢赐教~
gallery 展现图片时候。顶部的返回按钮容易让人理解错误,从而造成误操作。
比如页面stack 是
A > B > Gallery
此时点击返回按钮,会返回到 A,而不是用户期望的 B。
怎么把seats组件删除了呢
想使用wux当中的组件,但是wepy没有用到自带的es6转es5,如何设置使用babel用wux呢,请不吝赐教🤕
如题,请问能适配wepy的使用吗
手机:iOS 11.2.6(15D100)
微信:6.6.5
工具:v1.02.1803210
基础库:1.9.91
复现:
JSON.stringify cannot serialize cyclic structures.
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]
}
}
你做的 这个组件,效果很漂亮。大赞,帮了我这个后端大忙。
通常,这个时候,会有一个但是。。。
但是,编程风格上面,我这个后端程序员就很痛苦了。。而且文档说明也不多,幸好有很多例子,而且还是特新潮的 ES6 的 例子。。老人家看起来很累啊,很累啊,很累啊,很累啊。。
$wuxPickerCity.init('city', {
title: '请选择目的地',
value: [18, 4, 4],
onChange(p) {
console.log(p)
this.setData({
city: p.value
})
},
})
市 不管传什么值都是默认第一个
我不知道为什么dialog.prompt取值要使用
that.data.$wux.dialog.prompt.response
这样长串的方法,是有特殊应用需求吗?
请问QRCODE模块,为什么开发者工具重新编译就报错,关闭项目重新打开又正常?
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,请问是我理解有误还是有其他方式来获得当前用户选中的评分值,谢谢:)
这个项目没有你们做的好,但是有些组建我觉得可以参考一下加进来,
参考项目
网上有一些下拉筛选的菜单组件感觉不是太好,看到大神的组件封装得逼格很高,可否有时间新增一个功能比较齐全的下拉筛选菜单组件?
能改进一下这个功能吗?要实现日历的起始日期设定和可选日期的设定分别定义
我使用例子程序就可以重现这个问题。
经过dubug,发现 filterbar.js的初始化方法里,options.items传过来了,options.onChange竟然是空的,所以点击排序等按钮不起作用
我看到源码里很多return !1 和 return !0,为什么不直接些return false or true,我一直不理解为什么要这么写?也没有搜索到到答案,想请教作者这样些有什么作用?
thirdScriptError
item.children.map is not a function;at pages/searchres/searchres page $wux.filterbar.onRadioChange function
TypeError: item.children.map is not a function
at Component.onRadioChange (http://778647474.appservice.open.weixin.qq.com/components/filterbar/filterbar.js:96:40)
at e.a (http://778647474.appservice.open.weixin.qq.com/__dev__/WAService.js:9:1781)
at N (http://778647474.appservice.open.weixin.qq.com/__dev__/WAService.js:8:29135)
at Function. (http://778647474.appservice.open.weixin.qq.com/__dev__/WAService.js:8:30690)
at http://778647474.appservice.open.weixin.qq.com/__dev__/WAService.js:9:3284
at http://778647474.appservice.open.weixin.qq.com/__dev__/WAService.js:4:5247
at e.(anonymous function) (http://778647474.appservice.open.weixin.qq.com/__dev__/WAService.js:4:18529)
at d (http://778647474.appservice.open.weixin.qq.com/appservice:16:7288)
at g.registerCallback (http://778647474.appservice.open.weixin.qq.com/appservice:16:7468)
at k.forEach (http://778647474.appservice.open.weixin.qq.com/appservice:16:3140)
Notification的time设置之后未生效,一直保持默认值
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实例,从性能上考虑有木有更好的办法?:)
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封装类里面定义的默认值,进行倒计时。
怎样修改封装的类
我用vue时有vux,现在小程序有wux,如果能有mpvue版的就超级棒了!
如题
您好,我看了您最近的更新,将筛选框点击空白处的事件绑定到onConfirm(e)事件上了,这样的话,点击空白处等同于点击确定。我觉得这样用户体验不是很好,因为点击空白一般发生在误点筛选,或者点击筛选之后发现没有需要的筛选项,只是简单的关闭筛选框而已。
建议将此时间单独绑定一下。
我按照我的需求新建了一个方法,components/filterbar/filterbar.js第60行后增加以下代码
/** * 点击空白筛选框消失 * @param {Object} e 事件对象 */ filterHide(e) { const { index } = e.currentTarget.dataset this.setData({ [
]: 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>
$wui.xxx.yyy这类都是onload之后才挂到Page的data上的,所以页面初始化时候没有这类数据
<template data="...$wui.xxx.yyy"
就报错
目前只找到笨办法手动提前设置好
Page({
data: {
$wui: { xxx: { yyy: [] } }
}
})
嘤嘤 拿小拳拳锤你胸口
如题
点击筛选之后,scroll-view打开,但是要关闭这个页面,需要点击下面确认才能关闭,如果点击左边空白的地方能关闭就好了,同样的,顶部的那一排,点击空白的地方也能自己关闭就好了
gallery 组件采用background的形式来展示图片,而目前微信background 不支持 wxfile://tmp_1432973527o6zAJs9mBPbqQXsTYTB65vWW18sU5cdb0c6f3ac57085fd7a0f027cd51fe5.jpg
这样的本地路径(这是iOS 10选区的本地图片的路径)。
VM261:2 webviewScriptError
firstRender not the data from Page.data;firstRender not the data from Page.data
Error: firstRender not the data from Page.data
希望能得到帮助, 谢谢!
如题
个人学习的时候遇到问题,此处的value如何给列表中多个星星?
场景页面:评价列表,一个列表里有多个评分和星星.
如何给每行item赋各自不同的value?
onLoad() { $wuxRater.init('decimal', { value: 3.7, disabled: !0, }) },
因为用你的这种形式对于我这种小白的很难自己封装组件,但是基于wepy的话就可以
如题
在安卓机上就正常,苹果手机用的是5S, 10.3系统,只试用了一下浮动按钮,其它组件未知。
另外无法在目前的开发工具预览你的工程(原打算在苹果机上测试其它组件是否正常)。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.