Skip to content
  • Home
  • Python教學
  • 科技新聞資訊
  • 網站開發教學
Copyright 網絡設計教學 2025
Theme by ThemeinProgress
Proudly powered by WordPress
  • Home
  • Python教學
  • 科技新聞資訊
  • 網站開發教學
網絡設計教學網絡設計教學,網站網頁教學,軟體使用教學
  • You are here :
  • Home
  • 科技新聞資訊
  • Vue 3.3“浪客劍心”發布- 科技資訊 – 中文開源技術交流社區
科技新聞資訊

Vue 3.3“浪客劍心”發布- 科技資訊 – 中文開源技術交流社區

Jiking 2023-05-12 Article

Vue 3.3 已正式發布,代號”Rurouni Kenshin”(浪客劍心)。

公告寫道,此版本專注於改進開發者使用體驗—— 特別是SFC<script setup>與TypeScript 的結合使用。一同發布的還有 Vue Language Tools 1.6(舊Volar),解決了Vue 與TypeScript 一起使用時許多長期存在的痛點。

升級到3.3 時,建議同時更新以下依賴項:

  • volar / vue-tsc@^1.6.4
  • vite@^4.3.5
  • @vitejs/plugin-vue@^4.2.0
  • vue-loader@^17.1.0 (if using webpack or vue-cli)

改進開發者使用<script setup> + TypeScript 的體驗

  • 面向宏支援類型導入和復雜類型

<script setup lang="ts">
import type { Props } from './foo'

// imported + intersection type
defineProps<Props & { extraProp?: string }>()
</script>

<script setup lang="ts" generic="T">
defineProps<{
  items: T[]
  selected: T
}>()
</script>

<script setup lang="ts" generic="T extends string | number, U extends Item">
import type { Item } from './types'
defineProps<{
  id: T
  list: U[]
}>()
</script>

// BEFORE
const emit = defineEmits<{
  (e: 'foo', id: number): void
  (e: 'bar', name: string, ...rest: any[]): void
}>()

// AFTER
const emit = defineEmits<{
  foo: [id: number]
  bar: [name: string, ...rest: any[]]
}>()
  • 使用defineSlots設置slots 類型

<script setup lang="ts">
defineSlots<{
  default?: (props: { msg: string }) => any
  item?: (props: { id: number }) => any
}>()
</script>

實驗性功能


<script setup>
import { watchEffect } from 'vue'

const { msg = 'hello' } = defineProps(['msg'])

watchEffect(() => {
  // accessing `msg` in watchers and computed getters
  // tracks it as a dependency, just like accessing `props.msg`
  console.log(`msg is: ${msg}`)
})
</script>

<template>{{ msg }}</template>

<!-- BEFORE -->
<script setup>
const props = defineProps(['modelValue'])
const emit = defineEmits(['update:modelValue'])
console.log(props.modelValue)

function onInput(e) {
  emit('update:modelValue', e.target.value)
}
</script>

<template>
  <input :value="modelValue" @input="onInput" />
</template>

<!-- AFTER -->
<script setup>
const modelValue = defineModel()
console.log(modelValue.value)
</script>

<template>
  <input v-model="modelValue" />
</template>

詳情查看完整Changelog。

#Vue #33浪客劍心發布 #科技資訊 #中文開源技術交流社區

You may also like

如何在 Shopify 主題開發中使用 Vue.js(預測搜尋 API)

上海网信办对属地 46 款 App 收集使用个人信息情况开展专项检查 – 科技資訊

微信、QQ 全新 UOS 版本发布 – 科技資訊

代码层面探索前端性能 | 京东云技术团队 – 京东云开发者的个人空间 – 科技資訊

Gitee 推荐 | 为开发者打造的代码解释器 Octopus

DataSophon —— 云原生大数据管家

相关贴文:

  1. WPS二次開發之加載項(一) – 一行程式碼一行淚- 科技資訊
  2. 從啟動開源項目到運營開源社區
  3. 北海Kraken:基於Flutter 構建的高性能Web 渲染引擎
  4. Vue 框架npm 週下載量激增十倍,尤雨溪表示非常疑惑- 科技資訊
  5. 尤雨溪Vue 2022 回顧及2023 展望- 科技資訊
Tags: 33浪客劍心發布, Vue, Vue 3.3“浪客劍心”發布, vue.js, 中文開源技術交流社區, 科技資訊

近期文章

  • 如何在WooCommerce頁面中添加產品視頻
  • WooCommerce的電話驗證器和格式 – 演示和快速設置
  • 如何自定義WooCommerce中的訂單摘要
  • JavaScript多線程|改進WordPress -WooCommerce網站性能|沒有插件
  • 如何在WooCommerce(分步)中恢復廢棄的購物車
  • WooCommerce擴展開發 – 使產品價格可編輯
  • WooCommerce vs Thrivecart-它將最適合您的業務
  • 相撲會員資格| WooCommerce會員插件教程
  • 使用Elementor&WooCommerce建立功能齊全的在線商店|沒有付費插件

標籤雲

Dropshipping ecommerce JavaScript Joomla OSCHINA博客 python REBELLION Shopify Shopify 商店設置 Shopify 直銷 Woocommerce WordPress 代發貨 刀塔2 和 商店 商業 喬姆拉 在 如何創建 Shopify 商店 如何在 如何建立 Shopify 商店 如何開始代出貨 年 店舖教學 店鋪化 店鋪培訓 教學 獲獎產品 直銷 Shopify 直銷教程 科技資訊 程式碼 網路業務 網路賺錢 臉書廣告 與 行銷 詳解 購物 跨平台 運輸船 適合初學者的 Shopify 教學課程 適合初學者的直銷 電子商務

Copyright 網絡設計教學 2025