為什麼需要Tensor.contiguous()? PyTorch中Tensor.contiguous()作用分析
阿新 • • 發佈:2020-12-15
一、v-text
用於渲染普通文字,無論何時,繫結的資料物件上msg
屬性發生了改變,插值處的內容都會更新。
1 2 3 |
<span v-text= "message" ></span>
<!-- 簡寫方式 -->
<span>{{message}}</span>
|
exportdefault{ data () {return{ message:"這裡可以包含html標籤"} } }
二、v-html
如果你想輸出真正的 HTML,你需要使用v-html
指令,v-text僅渲染標籤,不能解析 HTML 程式碼
1 2 3 4 5 6 7 8 9 |
<p v-text=“message”></p> <br> <p v-html= "message" ></p>
<script type= "text/javascript" >
var app = new Vue({
el: '#app' , //element
data: {
message: '<strong>Hello</strong> Vue!' ,
}
})
</script>
|
v-text展示效果: <strong>Hello</strong> Vue!
v-html展示效果:HelloVue!
總結:v-text和{{}}表示式渲染資料,不解析標籤。
v-html不僅可以渲染資料,而且可以解析標籤。