[譯]Vue 3:2020年中狀態更新

前言

以前我翻譯的[譯]尤雨溪:Vue3的設計過程提到過:尤雨溪但願能在2020年的上半年發佈Vue3.0,但眼看這都七月份了,2020年已通過半,許多人都跑去vue的issue問如今到底怎麼回事了,是否是心思全放在開發vite上了?vue

對此,尤雨溪在vuejs/rfc裏面開了個issue,特地來講明瞭vue如今的狀況:git

連接:github.com/vuejs/rfcs/…github

譯文

咱們的許多用戶都在問這個問題:Vue 3到底什麼時候才能準備就緒?咱們沒法給出確切的答案,由於預估軟件的交付時間原本就是不許確的。做爲一個非營利性項目,咱們但願專一於編寫優秀的軟件,而不是按時趕工期。但這確實是一個漫長的等待,並且咱們知道這些不肯定性會致使計劃使用Vue 3的項目變得困難。因此咱們想提供一些指導和詳細的狀態更新,以幫助咱們的用戶相應地調整他們的指望和計劃。vue-router

在Vue 3上花費的大部分時間都花在了設計和構建內核上,這帶來了許多使人興奮的改進。可是,爲了將整個框架標記爲「已就緒」,它不只僅涉及到Vue的核心部分。咱們還須要具備兼容版本的支持庫(Vue Router,Vuex,test utils),工具(CLI,eslint插件,瀏覽器devtool擴展,IDE擴展)和文檔(適用於新用戶和老用戶遷移)。儘管咱們一直在努力開發全部這些部分,但要使全部個各部分全都組合在一塊兒須要付出大量的努力和協調,所以很難準確的預測時間表。咱們最初但願在2020年上半年發佈Vue 3,但考慮到目前的進展,咱們必須從新對其進行調整。咱們當前的目標是7月中旬發佈RC版(候選版本),8月初發布3.0正式版。vuex

決策樹

可是,這並不意味着您不能如今就開始使用Vue 3。如今,大多數框架部分都處於beta或alpha狀態,而vue的核心版本已經由咱們的最初使用者進行了普遍的測試。阻止咱們進入RC的惟一緣由是瀏覽器devtools擴展(目前正在積極開發中)。全部重要的更改都已寫在RFC中了,而且咱們沒有要重大更改的計劃。若是您一直在等待使用Vue 3,如下是決策樹,可幫助您進行相應的計劃:vue-cli

IWantVue3()

async function IWantVue3() {
  await read(`https://github.com/vuejs/rfcs/pulls?q=is%3Apr+is%3Amerged+label%3Acore+-label%3Arevoked+-label%3A2.6+sort%3Acomments-desc`)

  if (isTrue("I just want to play with Vue 3"))) {
    // If you just want to try Vue 3 out - you can do it right now with Vite.
    // Vite (https://github.com/vitejs/vite) is a new dev/build tool that we
    // created that is lighter, faster and produces smaller bundles. It works
    // with Vue 3 out of the box.
    run(`npm init vite-app hello-vue3`)
    return
  }

  if (isTrue("I am planning to use Vue 3 for a new project")) {
    if (isTrue("I need IE11 support")) {
      await IE11CompatBuild() // July 2020
    }
    if (isTrue("RFCs are too dense, I need an easy-to-read guide")) {
      await migrationGuide() // July 2020
    }
    if (isTrue("I'd rather wait until it's really ready") {
      await finalRelease() // Targeting early August 2020
    })
    run(`npm init vite-app hello-vue3`)
    return
  }

  if (isTrue("I am planning to upgrade an existing Vue 2 project")) {
    await IE11CompatBuild()
    await migrationGuide()
    await ecosystem(
      // this is the tricky part: if you have an existing, non-trivial Vue 2
      // app, you likely are using some dependencies that are not yet
      // Vue-3-compatible, for example meta frameworks like Nuxt, or UI
      // component libraries like Vuetify. If that's the case, our suggestion
      // is don't be in a hurry to upgrade. It *will* take some time for the
      // ecosystem to catch up.
      // Also note that you can start using Vue Composition API in Vue 2 today
      // via https://github.com/vuejs/composition-api - we are also going to be
      // backporting compatible Vue 3 features to 2.x once 3.0 is out.
    )
    return
  }

  if (isTrue("I am the author of a Vue ecosystem library")) {
    // It's time to make your lib Vue 3 compatible!
    return
  }
}
複製代碼

框架目前的狀態

Vue 3 Core

Vue 3 Core已經處於測試階段兩個多月了。咱們已經合併了全部計劃中的重大更改RFC,而且在正式3.0版本以前沒有進一步的重大更改的計劃。npm

成千上萬的早期使用者已在新項目中使用過,並幫助咱們修復了許多bug還幫咱們發現了一些與Vue 2的不一致行爲。在此階段,咱們認爲Vue 3內核至關穩定,能夠用於RC。api

Vue Router

4.0版本的router hooks仍然存在一些輕微的與vue-router 3.x版本不一致行爲,但這是惟一致使Vue Router標記爲Beta的緣由。該版本的Vue Router可用於非關鍵的新項目上。瀏覽器

Vuex

Vuex 4.0和3.x之間的惟一區別是它兼容Vue 3!而且已經準備與Vue 3一塊兒進入RC階段。app

Vue CLI

當前能夠經過vue-cli-plugin-vue-next來在Vue CLI中使用Vue 3。您能夠搭建一個新項目,而後運行vue add vue-next去切換到Vue3。當達到RC時,Vue 3將成爲項目建立過程當中的一個選項。

請注意,若是您不是特別須要Webpack和兼容IE11,那麼也可使用Vite來啓動Vue 3項目。

JSX支持

當前有兩種針對Vue 3的JSX轉換實現,其語法略有不一樣(針對Vue的特定功能):

咱們正在用這個issue來收集你們的意見以確保設計的統一,並制定一個JSX中應如何處理Vue功能的正式規範。若是您將Vue與JSX一塊兒使用,請在該issue中提供您的反饋。

其餘項目

項目名 狀態
vue-devtools WIP(7月上旬支持Vue 3 beta)
eslint-plugin-vue v7.0.0-alpha.9 [GitHub地址]
@vue/test-utils v2.0.0-alpha.7 [GitHub地址]
vue-class-component v8.0.0-alpha.6 [GitHub地址]
vue-loader v16.0.0-beta.4 [GitHub地址]
rollup-plugin-vue v6.0.0-beta.6 [GitHub地址]
相關文章
相關標籤/搜索