起源$log:Vue.prototype.$log = console.log禁止场所:<template> <!-- Place 1 --> <div @click="$log"> <!-- Place 2 --> {{ $log }} <!-- Place 3 --> {{ $log('foo') }} </div></template><script>import Vue from 'vue'// Place 4Vue.prototype.$log('foo')export default { created() { // Place 5 this.$log('foo') },}</script>
1 回答
呼唤远方
TA贡献1856条经验 获得超11个赞
在深入研究no-restricted-syntax、vue/no-restricted-syntax规则和ASTs 之后,我终于开始工作了,以下是工作规则:
{
rules: {
'no-restricted-syntax': [
'error',
{
selector: '[name=$log]',
message: "Using '$log' is not allowed.",
},
],
'vue/no-restricted-syntax': [
'error',
{
selector: '[name=$log]',
message: "Using '$log' is not allowed.",
},
],
},
}
添加回答
举报
0/150
提交
取消