diff --git a/src/pages/demo/business/table/keyboard/keyboard-extend.js b/src/pages/demo/business/table/keyboard/keyboard-extend.js index 21cb7816..236f8e00 100644 --- a/src/pages/demo/business/table/keyboard/keyboard-extend.js +++ b/src/pages/demo/business/table/keyboard/keyboard-extend.js @@ -1,22 +1,22 @@ +import sleep from '@/utils/sleep.js' + export default { mounted () { - // 写法 1 测试有效 - window.onload = () => { - console.log(this.$refs) - console.log('----') - for (let prop in this.$refs) { - console.log(this.$refs[prop]) - } - } + this.keyboardExtentInit() }, methods: { // 初始化 - keyboardExtentInit () { - // + async keyboardExtentInit () { + await sleep(1000) + for (const propName in this.$refs) { + if (this.$refs.hasOwnProperty(propName)) { + console.log(propName, this.$refs[propName]) + } + } }, // 返回ref名称 keyboardExtentRefNameMaker (scope) { - return `${scope.$index}${scope.column.property}` + return `kb-${scope.$index}-${scope.column.property}-kb` } } }