1.绑定属性
<template> <div id="app"> <!-- 绑定属性 --> <br> <div v-bind:title=‘title‘>鼠标悬浮出现</div> <br> <img :src="url" alt="仙女"> </div> </template> <script> export default { name: ‘app‘, data () { return { title:‘鼠标悬浮出现‘, url:‘https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1569319252742&di=0eaf19ed1e01d10d7f612da9434599a6&imgtype=0&src=http%3A%2F%2Fimg3.duitang.com%2Fuploads%2Fitem%2F201603%2F28%2F20160328121906_ErzAB.thumb.700_0.jpeg‘ } } } </script> <style> </style>
2.绑定html
<template> <div id="app"> <!-- html绑定 --> <div v-html="h"></div> </div> </template> <script> export default { name: ‘app‘, data () { return { h:‘<h2>二级标题</h>‘ } } } </script> <style> </style>
原文地址:https://www.cnblogs.com/xuepangzi/p/11578524.html
时间: 2024-11-04 15:28:32