Vuejs:我如何在其中传递带有<router-link>的句子作为道具?

时间:2018-02-21 11:21:56

标签: javascript html node.js vue.js directive

我在Vue.js中创建了答案和问题页面,答案被封装在另一个组件中。但是,当我尝试这样做时:

<template>
<div>
<answer-box
      answerId="availability"
      question="Do you stil make ABC?"
      :answer="answer1" />
</div>
</template>

<script>
import AnswerBox from '@/components/FAQAnswer'

export default {
  components: {
    AnswerBox,
  },
  data() {
    return {
      answer1: 'Sorry, but <strong>no</strong> &mdash; we don\'t make 
      those anymore. However, you may head to our
      <router-link to="/partners">partners</router-link>
      to check if they still have them',
    }
  },
}
</script>

我尝试使用计算道具将&quot;替换为" 替换&#34;通过道具时使用&quot;并放置这些 道具到v-html指令。句子被渲染,但是 router-link呈现为常规字符串(无链接)

btw,我使用vue 2.5,vscode,eslint 4.10,节点8.9.3,webpack 3.8

0 个答案:

没有答案