1.开发工具:官方推荐:https://www.dcloud.io/hbuilderx.html

2.学习文档:官方文档:https://uniapp.dcloud.io

3.页面规范:

.vue 文件是一个自定义的文件类型,用类 HTML 语法描述一个 Vue 组件。每个 .vue 文件包含三种类型的顶级语言块
<template>、<script> 和 <style>
还允许添加可选的自定义块。

  1. <template>
  2. <view class="content">
  3. <image class="logo" src="/static/logo.png"></image>
  4. <view class="text-area">
  5. <text class="title">{{title}}</text>
  6. </view>
  7. </view>
  8. </template>
  9. <script>
  10. export default {
  11. data() {
  12. return {
  13. title: 'Hello'
  14. }
  15. },
  16. onLoad() {
  17. },
  18. methods: {
  19. }
  20. }
  21. </script>
  22. <style>
  23. .content {
  24. display: flex;
  25. flex-direction: column;
  26. align-items: center;
  27. justify-content: center;
  28. }
  29. .logo {
  30. height: 200rpx;
  31. width: 200rpx;
  32. margin-top: 200rpx;
  33. margin-left: auto;
  34. margin-right: auto;
  35. margin-bottom: 50rpx;
  36. }
  37. .text-area {
  38. display: flex;
  39. justify-content: center;
  40. }
  41. .title {
  42. font-size: 36rpx;
  43. color: #8f8f94;
  44. }
  45. </style>

vue-loader 会解析文件,提取每个语言块,如有必要会通过其它 loader 处理,最后将他们组装成一个 ES Module,它的默认导出是一个 Vue.js 组件选项的对象。
vue-loader 支持使用非默认语言,比如 CSS 预处理器,预编译的 HTML 模版语言,通过设置语言块的 lang 属性。例如,你可以像下面这样使用 Sass 语法编写样式:
注意:每个.vue文件最多包含一个**