【问题标题】:Href migration from 1.x to 2.x?Href 从 1.x 迁移到 2.x?
【发布时间】:2017-02-26 07:05:19
【问题描述】:

我有以下带有 php 标签的 href。它适用于 1.x,我需要迁移到 2.x 版本。

 <a  href="<?=base_url('report/message/compose/{{student.StudentID}}')?>">test</a>

如何更改为在 2.x 版本上工作?

【问题讨论】:

    标签: vuejs2 vue-component vue.js


    【解决方案1】:

    你应该能够做到这一点:

    <a :href="'/report/message/compose/' + student.StudentID">test</a>
    

    【讨论】:

    • 我们不能在那里添加 =base_url()?> 吗?
    • @user3391137 为什么需要这个?
    • 我从 ("localhost/app/demo/school/student" ) 调用这个 href。我的基本 url 是 base_url() 中给出的“localhost/app/demo”。所以这个 href 想要链接“localhost/app/demo/report/message/compose' + student.StudentID”。这就是我附加 base_url() 的原因。
    • base_url的一个函数,如果是的话,可以加一下吗?
    • 正如你所说,我可以通过使用 :href=" '/app/demo/report/message/compose/' + student.StudentID" 之类的 url 来完成它。我不喜欢将“/app/demo/”附加到所有网址。这就是我调用这个 base_url() 的原因。
    【解决方案2】:

    可以这样。

    <a  v-bind:href=" '<?=base_url('report/message/compose/')?>' + student.StudentID">test</a>
    

    【讨论】:

      猜你喜欢
      • 2018-08-10
      • 2017-03-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-08-24
      • 2019-07-21
      • 1970-01-01
      相关资源
      最近更新 更多