Giter Club home page Giter Club logo

Comments (13)

pangxie1991 avatar pangxie1991 commented on May 13, 2024

可以的,等官方的自定义组件稳定一点,我们会考虑迁移。

不过,现在遇到如果自己有用 zanui-weapp 封装复杂业务组件的话,在调用业务组件的页面,要写上业务组件里使用的所有的自定义组件。这个体验有点差。。

from vant-weapp.

shoung6 avatar shoung6 commented on May 13, 2024

官方的封装方法还一个问题是,没办法直接做到组件内外变量的同步,像popup组件的isShow属性,组件内值变了之后,组件外没有同步,再去打开就没效果了。我们现在在考虑要不要用官方自定义组件封装业务组件~

from vant-weapp.

pangxie1991 avatar pangxie1991 commented on May 13, 2024

恩,可以试试触发一个事件,然后做成受控组件的形式,由外部完全控制组件
不过这样有点麻烦,不知道小程序会不会支持 .sync 这种

from vant-weapp.

qiu8310 avatar qiu8310 commented on May 13, 2024

内外同步感觉需要用全局变量来控制会好些,但这个全局变量只会暴露在指定的组件之内

from vant-weapp.

qiu8310 avatar qiu8310 commented on May 13, 2024

@pangxie1991 有没有考虑使用 minapp 封装一套你们的 ui,minapp 上解决了双向绑定的问题,这是双向绑定原理

另外 minapp 核心代码压缩后只有 15KB,可以说非常小了;而且支持直接引用 npm 上的小程序组件,不用再把文件复制来复制去了;而且 minapp 完全兼容原生的小程序组件,如果不想用双向绑定,不需要引入任何 minapp 的代码,发布到 npm 上,minapp 的用户就可以安装并直接使用你的组件。

from vant-weapp.

qiu8310 avatar qiu8310 commented on May 13, 2024

其实之前问过你们为什么不用官方组件开发 #139 ,你们有人回答过我其中一个点是写样式不方便,主要自定义组件默认样式都是 inline 的,所以每个组件都需要用户去设置样式,但其实官方有解决方案的,只需要在组件样式中设置

:host {
  display: block;
}

就可以把这个组件的样式默认设置成 block 了,详情看这里 https://mp.weixin.qq.com/debug/wxadoc/dev/framework/custom-component/wxml-wxss.html#%E7%BB%84%E4%BB%B6%E6%A0%B7%E5%BC%8F

我觉得原生的组件已经足够灵活了!你们完全可以封装!

from vant-weapp.

pangxie1991 avatar pangxie1991 commented on May 13, 2024

@qiu8310 是的,官方的自定义组件库一直在升级,我们这里尝试下新的代码片段套路和自定义组件结合的方案~

谢谢提意见~ 最近我们会组织一波人来更新~欢迎给我们多提提意见&反馈

from vant-weapp.

pangxie1991 avatar pangxie1991 commented on May 13, 2024

已经开始封装~ 近期我们就会完成组件库的 自定义组件 化,具体可以关注 upgrade_to_custom_component 这个分支的改动进度~

from vant-weapp.

yuu2lee4 avatar yuu2lee4 commented on May 13, 2024

nice 好久能用呢 再过一段时间就要开发小程序了

from vant-weapp.

pangxie1991 avatar pangxie1991 commented on May 13, 2024

升级自定义组件的代码已和入,下周会发包并更新文档网站~

from vant-weapp.

yuu2lee4 avatar yuu2lee4 commented on May 13, 2024

会发npm包?

from vant-weapp.

pangxie1991 avatar pangxie1991 commented on May 13, 2024

会有 npm 包和 git 的tag。方便 bower 和 npm 的使用

from vant-weapp.

pangxie1991 avatar pangxie1991 commented on May 13, 2024

已推送,如有使用问题,欢迎 issue~

from vant-weapp.

Related Issues (20)

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.