当前位置: 首页 > 工具软件 > flask-vuejs > 使用案例 >

vue raw html,javascript - Vuejs - Render raw html links to <router-link> - Stack Overflow

卫松
2023-12-01

I;m new to VueJS and I'm making some weird experiments. I build a backend service using python/flask and this backend provide me a string of html code with many tags inside, I want to render this inside my Vue app, I have a method for calling the backend that looks like this:

async execute (method, resource, data) {

return client({

method,

url: resource,

data: data

}).then(async req => {

return req.data.html

})

},

callBack (id) {

console.log(id)

return this.execute('post', '/content/', {body: { 'id': id }})

}

And in the .vue file I have:

export default {

data () {

return {

loading: false,

launch: [],

html: 'none',

page: this.$route.params.article

}

},

beforeMount () {

console.log('beforeee')

this.html = api.callBack(this.page)

},

methods: {

async launch () {

this.launch = ''

this.html = await api.callBack(this.page)

}

}

}

so when I call the launch function it populates this.html, and this html variable lives in a v-html.Everything seems to work i get the html and render it in de container but the links are broken, the links should point at the same app something like #/test/linkvalue, but as they are tags, and in vue you have to use they doesn't work.

There is a way to achieve this "dynamic re route" or I'm doing something too weird?

The links are plenty, since they are scraped from the web, so manually parsing is not an option.

Thanks in advance for your help

 类似资料: