【问题标题】:Vuetify and nuxt.js - Rules should return a string or boolean, received 'undefined' insteadVuetify 和 nuxt.js - 规则应该返回一个字符串或布尔值,而不是收到“未定义”
【发布时间】:2020-12-01 20:07:24
【问题描述】:

我在我的工作中制作了一个应用程序。在文本区域中,像我的标题一样发生错误。我用谷歌搜索了同样的问题并阅读了它,但我对这类问题非常了解。

我的目标是我想使用文字作为对象。 但我认为规则不能使用文字对象。 我是超级初学者,我的英语不太好。 如果你明白请问我!

    <template>
    <v-card width="600" persistent>
        <v-card-tex>
            <v-row>
            <v-col cols="8">
                <v-textarea 
                    filed 
                    dense
                    v-model="testtext"
                    :rules="v=>!!v||'this is required!'"></v-textarea>
            </v-col>
        </v-row>
        </v-card-tex>
    </v-card>
</template>

<script lang="ts">
import {Vue} from 'nuxt-property-decorator'

export default class extends Vue{
   testtext:string= `test`
}
</script>

【问题讨论】:

    标签: typescript vue.js vuetify.js


    【解决方案1】:

    我认为你应该在 v-textarea 中使用这样的规则:

    :rules="[v => !!v||'this is required!']"
    

    【讨论】:

      猜你喜欢
      • 2020-08-16
      • 2021-01-05
      • 2021-10-20
      • 2016-01-06
      • 1970-01-01
      • 1970-01-01
      • 2019-01-17
      • 2012-04-30
      • 1970-01-01
      相关资源
      最近更新 更多