.vue 文件可以不写 JS, 也可以不写 CSS 和 html. 也就是说一个空的 vue 文件也能正常使用而不报错.
正常情况下, 一个. vue 文件结构如下:
- <template>
- <div class="hello">
- </div>
- </template>
- <script>
- export default {
- name: '',
- props: {
- }
- }
- </script>
- <style scoped>
- </style>
JS 代码在 script 标签中写, 不写 JS 代码也能正常运行.
<script> </script>
本文来自 vue.js 答疑 https://www.html.cn/qa/vue-js/ 栏目, 欢迎学习!
来源: http://www.css88.com/qa/vue-js/15269.html