--- title: "「Web 前端」在 Vue 中使用 JSX 的语法" date: 2025-03-15T23:05:31Z lastmod: 2025-10-07T16:10:57Z tags: [Web 前端,JavaScript,JSX,Vue.js] --- # 「Web 前端」在 Vue 中使用 JSX 的语法 ## 来源 - [GitHub - vuejs/jsx](https://github.com/vuejs/jsx#syntax) ## 语法 ### 内容(Content) ```javascript render() { return
hello
; } ``` 动态内容: ```javascript render() { returnhello { this.message }
; } ``` 使用自闭合标签: ```javascript render() { return ; } ``` 使用组件: ```javascript import MyComponent from './my-component'; export default { render() { returnhello {props.message}
); ``` ```javascript const HelloWorld = ({ props }) => (hello {props.message}
); ```