僅支持HBuilderX 1.9.0+

什麼是 vue doc ?

可以理解爲,vue組件使用說明。

在其它文件,使用組件的時候,彈出代碼提示。

什麼是組件?組件是可複用的 Vue 實例,且帶有一個名字。

語法

主要用在script部分,需要寫在export default上面

  1. /**
  2. * 這裏是一個組件描述,會在提示標籤的時候顯示
  3. * @description 這裏也是一個組件描述
  4. * @tutorial https://uniapp.dcloud.io/api/media/image?id=chooseimage
  5. * @property {String} type = [button|input|...值域] 這裏是屬性描述
  6. * @event {Function} tap 這是是事件描述
  7. * @example 這裏是示例代碼
  8. */

其中@property和@event內{ }中間的是類型,event的類型必須是Function

示例

  1. <script>
  2. /**
  3. * 翻頁組件
  4. * @description 翻頁組件
  5. * @tutorial http://www.baidu.com
  6. * @property {Number} total 翻頁數據總數
  7. * @property {String} size = [big|small] 組件大小
  8. * @event {Function} close 關閉事件
  9. * @example <Pagination @total="50" @close=""></Pagination>
  10. */
  11. export default {
  12. props: {
  13. "total": Number,
  14. "size": String
  15. },
  16. data () {
  17. return {
  18. pageSize: 10,
  19. pageNumber: 0
  20. }
  21. },
  22. methods: {
  23. handleChange(data, event) {
  24. this.$emit('PsPn', this.pageSize, this.pageNumber)
  25. }
  26. }
  27. }
  28. </script>

組件提示,效果如下:

什麼是 vue doc ? - 图1

什麼是 vue doc ? - 图2

屬性提示:

什麼是 vue doc ? - 图3

事件提示:

什麼是 vue doc ? - 图4