爱意满满的作品展示区。
spiritree

用 Vue 渐进式搭建聊天室,从 JavaScript=>TypeScript

  •  
  •   spiritree ·
    spiritree · Oct 31, 2017 · 5534 views
    This topic created in 3290 days ago, the information mentioned may be changed or developed.

    前言

    Vue+Socket.io 这个轮子已经有很多人造过了,为了不重复造轮子,我将本项目以三阶段实现(大家可以在 github 中的 Releases 查看):

    • 纯前端( Vuex )
    • 后端+前端( JavaScript )
    • 后端+前端( TypeScript )

    希望能给大家一个渐进学习的经验。

    预览

    vuechat0.png

    预览地址: https://app.spiritree.me

    文章地址: https://juejin.im/post/59f5de305188254eaf27d729

    Github 地址: https://github.com/spiritree/vue-socket.io-chat

    欢迎 Star&Fork 谢谢大家

    11 replies  •  2017-11-06 11:47:24 +08:00
    ipwx
    ipwx
    Oct 31, 2017
    1
    能不能科普一下 TypeScript 有啥好?
    qdwang
    qdwang
    Oct 31, 2017 via iPhone❤️1
    2
    @ipwx 类型安全 适合做大项目
    缺点是编译慢 不适合做大项目
    SuperMild
    SuperMild
    Oct 31, 2017 via iPhone
    3
    没有说为啥要转到 ts 啊
    ipwx
    ipwx
    Oct 31, 2017
    4
    @qdwang 但是我映像中 TS 和 Vue 的集成非常差。很多 Vue 生态的第三方库都不怎么支持 TS,连 Vue 自身都有点够呛。编译慢不是什么特别要考虑的事情,再慢能比 C++ 慢?
    spiritree
    spiritree
    OP
    Oct 31, 2017
    5
    @ipwx Vue2.5 针对 TS 改进很多以后也会大力支持,目前用的最多的 element-ui 是有类型声明的,其他不了解
    HuJian201
    HuJian201
    Oct 31, 2017
    6
    既然 TypeScript 了为何不直接上 Angular
    coldsnap
    coldsnap
    Oct 31, 2017
    7
    @qdwang tsc 比 babel 快多了
    spiritree
    spiritree
    OP
    Oct 31, 2017
    8
    @HuJian201 现在的 Vue 也很 Angular 啊~特别是装上 vue-class-component,Angular 成本还是比 Vue 高不少
    spiritree
    spiritree
    OP
    Oct 31, 2017❤️1
    9
    jamesliu96
    jamesliu96
    Nov 3, 2017
    10
    @qdwang 哈哈哈哈哈哈哈哈哈哈哈哈哈你这个黑得漂亮
    HuJian201
    HuJian201
    Nov 6, 2017
    11
    @spiritree 额,感觉 Vue 和 TypeScript 的搭配还没有到 ng 的水平,成本的话 ng 确实比 vue 高。。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2500 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 15:20 · PVG 23:20 · LAX 07:20 · JFK 10:20
    ♥ Do have faith in what you're doing.