Note that HTML attributes are case-insensitive and camelCased props need to use their kebab-case
2020-04-30 15:26
78 查看
Prop 的大小写
<div id="prop-demo"> <p>Prop 的大小写 (camelCase vs kebab-case)</p> <prop-blog postTitle="hi"></prop-blog> </div> Vue.component('prop-blog',{ // 在 JavaScript 中是 camelCase 的 props: ['postTitle'], template: '<h3>{{ postTitle }}</h3>' }) new Vue({ el:'#prop-demo' }) 改为: <div id="prop-demo"> <p>Prop 的大小写 (camelCase vs kebab-case)</p> <!-- 在 HTML 中是 kebab-case 的 --> <prop-blog post-title="hi"></prop-blog> </div>
HTML 中的 attribute 名是大小写不敏感的,所以浏览器会把所有大写字符解释为小写字符。这意味着当你使用 DOM 中的模板时,camelCase (驼峰命名法) 的 prop 名需要使用其等价的 kebab-case (短横线分隔命名) 命名:
重申一次,如果你使用字符串模板,那么这个限制就不存在了。
相关文章推荐
- [BTS] Correct the specified Action, or refer to the documentation on the allowed formats for the Actions. Note that Actions are case-sensitive.
- Given a list of presentations with begin and end time that all need to use a conference room.
- You are using safe update mode and you tried to update a table without a WHERE that uses a KEY colum
- ErrorCode:1175.You are using safe update mode and you tried to update a table without a WHERE that u
- Trying to use an SPWeb object that has been closed or disposed and is no longer valid.
- You are using safe update mode and you tried to update a table without a WHERE that uses a KEY colum
- MySQL错误:You are using safe update mode and you tried to update a table without a WHERE that uses a K
- Error Code: 1175 You are using safe update mode and you tried to update a table without a WHERE that
- eclipse server locations disabled and need to change to use tomcat installation
- Use the PDFs below or the HTML contents to the left to install and configure P6 EPPM and its additional components.
- [Templates That Are Usually Used]Header Files Include and Pre-Process(ToBeContinued)
- Why Prepared Statements are important and how to use them "properly"
- Error Code: 1175 You are using safe update mode and you tried to update a table without a WHERE that
- Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. T
- Programming Terms: Closures - How to Use Them and Why They Are Useful
- Easy way to use JText 2.1.7 and HTML-style template for generating report
- rror Code: 1175. You are using safe update mode and you tried to update a table without a WHERE that uses a KEY column To disable safe mode, toggle the option in Preferences -> SQL Editor and reconnec
- you are the ont that we would like to trust and ca...
- 处理MySQL更新表时ErrorCode:1175.You are using safe update mode and you tried to update a table without a WHERE that uses a KEY
- Trying to use an SPWeb object that has been closed or disposed and is no longer valid.