How to run script in v-html

2019-02-27 17:48发布

I get embed codes (Instagram, Twitter and so on) from database. How to bind them to a vue component? Is there any way for executing script tag in v-html?

1条回答
孤傲高冷的网名
2楼-- · 2019-02-27 18:24

Short answer: You can't. Your browsers blocks the execution of script tags once the dom has loaded.

Long answer: You could try matching the src attribute of the script and fetch + evaluate it, or match the inner content of the div and evaluate it, but this is not recommended.

查看更多
登录 后发表回答