10个简单的技巧让你的 vue.js 代码更优雅
来源 | https://juejin.im/post/6854573215969181703 前言 作为深度代码洁癖,我们都希望能写出简单高效的代码,让我们的代码看起来更加优雅,让我们抛弃繁杂的代码,一起开启简单的旅程~~ 01、slots 新语法向 3.0 看齐 使用带有“#”的新命名插槽缩写语法,在Vue 2.6.0+中可用 举个例子: 构建插槽时,最好规划一下布局。这就是我的文章布局。构建插槽与构建组件没有什么不同。本质上,插槽是具有超强功能的组件,让我们细分一下上面的布局,组件的外观如下: <!-- TidbitPage.vue --><template> <article-layout> <template #articleHeader> <h1>I am the header</h1> </template> <template #articleContent> <p>I am the content</p> </template> <...














