內(nèi)容渲染
- 采用 :進行屬性渲染
- 創(chuàng)建 demo3.html,內(nèi)容如下
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- 1. 導入 vue 腳本文件 -->
<script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
</head>
<body>
<div id="app">
<a :href="link">必應</a>
<br><br>
<input type="text" :placeholder="inputValue">
<br><br>
<img :src="imgSrc" :style="{width: imgWidth}" alt="">
</div>
</body>
<script>
const vm = {
data: function() {
return {
// 超鏈接地址
link: "https://cn.bing.com/",
// 文本框提示內(nèi)容
inputValue: '請輸入內(nèi)容...',
//圖片src link
imgSrc: 'https://i2.3conline.com/images/piclib/201108/25/batch/1/107243/13142814749678n41h8hc7p.jpg',
//圖寬
imgWidth: '200px',
}
}
}
const app = Vue.createApp(vm)
app.mount('#app')
</script>
</html>
效果展示
文章來源地址http://www.zghlxwxcb.cn/news/detail-705297.html
文章來源:http://www.zghlxwxcb.cn/news/detail-705297.html
到了這里,關于vue學習之屬性綁定的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網(wǎng)!