惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hacker News: Front Page
P
Palo Alto Networks Blog
T
ThreatConnect
Apple Machine Learning Research
Apple Machine Learning Research
博客园_首页
T
True Tiger Recordings
P
Privacy & Cybersecurity Law Blog
B
Blog
IT之家
IT之家
Last Week in AI
Last Week in AI
F
Full Disclosure
Hacker News: Ask HN
Hacker News: Ask HN
C
Comments on: Blog
Microsoft Azure Blog
Microsoft Azure Blog
C
Cybersecurity and Infrastructure Security Agency CISA
Microsoft Security Blog
Microsoft Security Blog
博客园 - 【当耐特】
N
News and Events Feed by Topic
NISL@THU
NISL@THU
腾讯CDC
雷峰网
雷峰网
Security Latest
Security Latest
李成银的技术随笔
M
Microsoft Research Blog - Microsoft Research
L
LangChain Blog
L
Lohrmann on Cybersecurity
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Check Point Blog
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
博客园 - Franky
N
News | PayPal Newsroom
V
V2EX
A
About on SuperTechFans
The Register - Security
The Register - Security
月光博客
月光博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Google Online Security Blog
Google Online Security Blog
MyScale Blog
MyScale Blog
Cisco Talos Blog
Cisco Talos Blog
Vercel News
Vercel News
WordPress大学
WordPress大学
C
Cyber Attacks, Cyber Crime and Cyber Security
The Hacker News
The Hacker News
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
IntelliJ IDEA : IntelliJ IDEA – the Leading IDE for Professional Development in Java and Kotlin | The JetBrains Blog
爱范儿
爱范儿
A
Arctic Wolf
L
LINUX DO - 最新话题
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More

博客园 - x3d

deepin 23 一个可用 mysql-workbench 版本 8.0.36 基于 Maxwell 实现 MySQL 数据实时迁移到 Mongodb 本地开发环境 通过Podman 手动从头搭建 Ubuntu 容器镜像 intel ax203/ax201 无线网卡驱动 firmware 居然有问题 Direct firmware load for iwlwifi-bz-b0-hr-b0-94.ucode failed with error -2 在安卓平板上搭建 webdav 服务 近期不要选aliyun cloud linux 镜像 一点 PHP 中优雅的将JSON/XML/YAML 等数据反序列化成指定的类对象 开始收割了 PHP Composer 虚拟依赖包 - 实现按需载入钉钉对应功能模块的 php sdk 盘点之原地踏步三 盘点之原地踏步二 apijson 初探 Apache Synapse ESB erupt api Think3 ORM 《超文本和超链接》的时间线整理 MEAF框架概念检索工具 现代企业架构框架MEAF初次解读
盘点之原地踏步一:weui 的一点探索
x3d · 2022-12-25 · via 博客园 - x3d

2022的最后这一个月,自己很忙,每天起早贪黑,但是停下来一盘算,仍然是没什么有价值的可复用的产出物,一如过去这些年。

想探索基于企微或钉钉这种群件(groupware,我倾向于这么叫,至今最为激进的钉钉也仍然没有超越群件当初定义的三范式)平台做新时代下的业务流程性功能开发的可行性,一路下来发现坑不少,一个多月时间都花在填坑上了。

最后是在企微应用要求尽量遵循 weui 风格这一点上,这几天就一直在摸索这一块;为什么是“摸索”;weui 从官方产出物来看,只有 css 定义 和 一些 examples,没有文档;尽管官方也有 react-weui、以及市面上还有一些第三方维护的 weui 的组件化封装。

因而,我在想 weui 到底是什么。

第一反应,它是微信官方定义的一套视觉语言,不过这一块的完整概念是以前在 ant.design 的网站上“设计”板块看到的。

二,因为在考虑如何基于 weui 的语言实现更有生产力的组件化应用,在翻看各种相关库和源代码,看到 vant 的代码,用了 vue 的 create util 模块,里面提到了 createBEM,然后发现 BEM 的线索,最后搜索发现,是 Block__Element--Modifier 这样的一套前端组件化方法。回过头来,在 weui 官方 github 的 wiki 里也看到了一段描述,它从 1.0 开始也是启用了 bem 的命名方式。


/**
 * bem helper
 * b() // 'button'
 * b('text') // 'button__text'
 * b({ disabled }) // 'button button--disabled'
 * b('text', { disabled }) // 'button__text button__text--disabled'
 * b(['disabled', 'primary']) // 'button button--disabled button--primary'
 */
export function createBEM(name: string) {
  return (el?: Mods, mods?: Mods): Mods => {
    if (el && typeof el !== 'string') {
      mods = el;
      el = '';
    }

    el = el ? `${name}__${el}` : name;

    return `${el}${genBem(el, mods)}`;
  };
}

export type BEM = ReturnType<typeof createBEM>;

export function createNamespace(name: string) {
  const prefixedName = `van-${name}`;

三、在脑子里尝试从 weui 官方的 less 定义和 example 中提取组件的时候,发现了 vant 与它的一种潜在可能的联系性,猜测 vant 也许是有赞在微信生态中生存过程消化 weui 的一个技术副产物。

四、时间线

bem 代码仓库 最早的提交时间;

Initial commit
floatdrop committed on Aug 24, 2014


https://github.com/Tencent/weui/

init weui
jfengjiang committed on Sep 25, 2015


react-weui 代码仓库最早的提交时间;

init
progrape committed on Dec 14, 2015


vant 最早提交时间

Author: niunai 
Date:   Tue Dec 27 20:11:05 2016 +0800

    init

而我最早关注前端组件化大概也是这个时候,2015-01-27 23:47

阿里前端框架Alice是个不错的选择

但是,我毕竟不是个纯前端,很早的时候,生存所迫,技术变成只是我的一种手段,而非单一信仰,因而没法在技术前沿推进。

只能从一个使用者角度,感受,跟进。

当我试着站在开发者角度,发现没有必要文档时,想利用现成工具如 @vant/cli 自己去做一些整理时,才稍稍能找回技术者的感觉。