miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.89k stars 257 forks source link

Error: Invalid default value for prop "anchorAttributes" #36

Closed transcranial closed 6 years ago

transcranial commented 6 years ago

v2.2.1: [Vue warn]: Invalid default value for prop "anchorAttributes": Props with type Object/Array must use a factory function to return the default value.

gismanli commented 6 years ago

same question

the vue verison is v2.4.2, vue-markdonw version is also v2.2.1.

randyrankin commented 6 years ago

Try this:

data: function () {
            return {
                anchorAttributes: {
                    target: '_blank',
                    rel: 'noopener noreferrer nofollow'
                },
             ...
            }
},

Then call anchorAttributes in your vue-markdown tag

<vue-markdown :anchor-attributes="anchorAttributes">{{ your.data }}</vue-markdown>
miaolz123 commented 6 years ago

fix in #39