【问题标题】:Fill input fields based on URL / BootstrapVue根据 URL / BootstrapVue 填写输入字段
【发布时间】:2021-11-25 12:59:54
【问题描述】:

我正在使用BootstrapVue。现在我尝试根据我的 URL 填写我的输入字段..

我的代码:

<template>
  <div class="col-md-6 mt-3">
    <div class="mt-2">ID</div>
    <b-form-input type="number"></b-form-input>
    <div class="mt-2">Name</div>
    <b-form-input type="text"></b-form-input>
  </div>
</template>

我的URL: localhost:8080/?UserID=1234&amp;Username=Peter_Parker

现在它应该用 1234 填充我的 UserID b-form-input,用 Peter Parker 填充我的用户名 b-form-input

这可能吗?提前致谢!

【问题讨论】:

    标签: javascript vue.js vuejs2 bootstrap-vue


    【解决方案1】:

    尝试:

    this.$route.query.UserID
    

    this.$route.query.Username
    

    【讨论】:

    • 我应该在哪里输入这个代码?
    • 嘿,伙计,在数据函数中为 id 和 name 创建属性,然后在模板中将这些属性与 v-model 绑定。在挂载的钩子中设置属性: this.id = this.$route.query.UserID ...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-22
    • 1970-01-01
    • 2023-03-21
    • 2017-11-07
    相关资源
    最近更新 更多