Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix getValue undefined #28

Closed
wants to merge 1 commit into from
Closed

fix getValue undefined #28

wants to merge 1 commit into from

Conversation

lceric
Copy link

@lceric lceric commented Jan 4, 2021

<template>
  <div class="btn">这是一个btn</div>
</template>

<script>
export default {
  props: {
    /**
     * 尺寸
     * @optional mini|small|medium|large
     */
    size: {
      type: String,
      default: 'medium',
    },
    /**
     * 禁用状态
     */
    disabled: String,
  },
  created() {
    // if remove the following line code, will be ok
    const { size, disabled } = this.$props
    // if (size) {
    //   console.log(size)
    // }
    // if (disabled) {
    //   console.log(disabled)
    // }
  },
}
</script>

In the process of analysis, disabled props, this.getValue(property.key) will return undefined.

{"type":"ObjectProperty","start":241,"end":245,"loc":{"start":{"line":18,"column":12},"end":{"line":18,"column":16}},"range":[241,245],"extra":{"shorthand":true},"method":false,"key":{"type":"Identifier","start":241,"end":245,"loc":{"start":{"line":18,"column":12},"end":{"line":18,"column":16},"identifierName":"size"},"range":[241,245],"name":"size"},"computed":false,"shorthand":true,"value":{"type":"Identifier","start":241,"end":245,"loc":{"start":{"line":18,"column":12},"end":{"line":18,"column":16},"identifierName":"size"},"range":[241,245],"name":"size"}}
"medium"
{"type":"ObjectProperty","start":247,"end":255,"loc":{"start":{"line":18,"column":18},"end":{"line":18,"column":26}},"range":[247,255],"extra":{"shorthand":true},"method":false,"key":{"type":"Identifier","start":247,"end":255,"loc":{"start":{"line":18,"column":18},"end":{"line":18,"column":26},"identifierName":"disabled"},"range":[247,255],"name":"disabled"},"computed":false,"shorthand":true,"value":{"type":"Identifier","start":247,"end":255,"loc":{"start":{"line":18,"column":18},"end":{"line":18,"column":26},"identifierName":"disabled"},"range":[247,255],"name":"disabled"}}
undefined
Waiting for the debugger to disconnect...
/Users/lichao/Documents/workspace/open-source/vue-sfc-md/node_modules/@vuedoc/parser/lib/parser/AbstractParser.js:172
          name = this.getValue(property.key).value;
                                            ^

TypeError: Cannot read property 'value' of undefined
    at /Users/lichao/Documents/workspace/open-source/vue-sfc-md/node_modules/@vuedoc/parser/lib/parser/AbstractParser.js:172:45

@demsking demsking deleted the branch vuedoc:master July 18, 2022 07:32
@demsking demsking closed this Jul 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants