lawsiki
V2EX  ›  Vue.js

vue3 的一个神奇问题,求解惑

  •  
  •   lawsiki · Oct 12, 2023 · 2010 views
    This topic created in 1143 days ago, the information mentioned may be changed or developed.
    charlie21
    charlie21
    Oct 12, 2023 via Android
    1
    直接在 return 里写东西,这让我想起了
    https://www.naiveui.com/zh-CN/os-theme/components/checkbox
    lawsiki
    lawsiki
    OP
    Oct 12, 2023
    2
    @charlie21 上手 vue3 就是用的这个框架😂
    zhangjiancheng
    zhangjiancheng
    Oct 13, 2023
    3
    没有仔细看过 setup 的源码,应该是 setup 在处理 return 的返回值时有做处理,实际在 add()内 console.log(this)也能看到 num 被处理过不需要.value 访问,就像 template 内访问 ref 一样不需要.value
    CHTuring
    CHTuring
    Oct 13, 2023
    4
    因为 setup 中 return 其实就是 render 函数
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1420 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 16:55 · PVG 00:55 · LAX 08:55 · JFK 11:55
    ♥ Do have faith in what you're doing.