系列文章目录
目录
前言
vue3与vue2的区别及特性。
具体信息
- 页面不用跟标签包裹
- css中可以直接使用js中的变量
<template> <div class="box"></div> <router-view /> </template> <script setup> const boxWidth = '100px' </script> <style lang="scss"> .box { width: v-bind(boxWidth); height: 100px; background: blue; } </style>
- setup 函数是一个新的组件选项。作为在组件内使用 Composition API 的入口点。
<template> <div