小编Pic*_*iao的帖子

[Vue 警告]:属性或方法“v”未在实例上定义但在渲染期间被引用

这是我的组件。 el.focus()插入时确实有效,但我进入[Vue warn]: Property or method "v" is not defined on the instance but referenced during render了控制台。如何去除警告?

<script>
  export default {
    directives: {
      focus: {
        inserted (el) {
          el.focus()
        }
      }
    }
  }
</script>
Run Code Online (Sandbox Code Playgroud)
<style lang="stylus" scoped>
  input
    width: 300px
    height: 30px
    border: 1px solid #000
</style>

<template lang="jade">
  div
    input(v-focus)
</template>
Run Code Online (Sandbox Code Playgroud)

javascript vue.js pug

2
推荐指数
1
解决办法
2772
查看次数

标签 统计

javascript ×1

pug ×1

vue.js ×1