慕的地10843
2024-01-18 14:40:56
起源$log:Vue.prototype.$log = console.log禁止場(chǎng)所:<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 回答

呼喚遠(yuǎn)方
TA貢獻(xiàn)1856條經(jīng)驗(yàn) 獲得超11個(gè)贊
在深入研究no-restricted-syntax、vue/no-restricted-syntax規(guī)則和ASTs 之后,我終于開始工作了,以下是工作規(guī)則:
{
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.",
},
],
},
}
添加回答
舉報(bào)
0/150
提交
取消