仅支持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