代码之家  ›  专栏  ›  技术社区  ›  Alex

不带jsx的.vue文件

  •  1
  • Alex  · 技术社区  · 6 年前

    有没有办法 .vue

    我喜欢把所有的组件和模板放在不同的文件中,但这种愚蠢的“语言”让我抓狂。

    3 回复  |  直到 6 年前
        1
  •  1
  •   Hozhabr    6 年前
     ///// example.vue
    <temlate>
        // Write Html codes .....
    </temlate>
    
    <style lang="scss" scoped>
        // Write isolate style
    </style>
    
    <script>
    ////    Example javascript code
    import { mapState } from 'vuex';
    import PageBreadcrumb from './breadcrumb';
    import IssuePage from '~/components/common/issue-page';
    
    export default {
        components: {
            PageBreadcrumb
        },
        extends: IssuePage,
        computed: {
            ...mapState('domestic', ['confirmInfo']),
            urlSuffix: () => 'domestic-flights'
        }
    };
    </script>
    
        2
  •  2
  •   Matthias S    6 年前

    在.vue文件中不需要使用jsx。

    只需编写纯HTML

    示例.vue

    <template>
        <div>
            Hello, I am just HTML
        </div>
    </template>
    
    <script>
        export default {}
    </script>
    
        3
  •  1
  •   Pierre Trollé    6 年前

    对。只需使用vue cli生成第一步项目。代码中不会有任何JSX。