< template> < div> < p> </ p> < p> </ p> < p> </ p> < p> </ p> < p> </ p> < p> </ p> < p> </ p> < p> </ p> < p> </ p> < pv-text = " htmlContent" > </ p> < pv-html = " htmlContent" > </ p> < pv-for = " (item, key, index) in obj" > </ p> < pv-if = " myBool" > </ p> < pv-show = " myBool" > </ p> < button@click = " btnT1" > </ button> < button@click = " btnT2" > </ button> < button@click = " btnT3" > </ button> < p:title = " title" > </ p> < inputtype = " text" v-model = " inputValue" /> < pv-text = " inputValue" > </ p> < p> </ p> < pv-text = " inputValue" ref = " pRef" :data-refData  =  " this.myInt" > </ p> < inputtype = " text" v-model.trim = " inputValue" > </ div> </ template> < script> 
export  default  { data ( )  { return  { title :  0 , content :  "这是内容文本" , htmlContent :  "这是一个<span>span</span>标签" , arr :  [ "a" ,  "b" ,  "c" ,  "d" ] , obj :  {  a :  10 ,  b :  30 ,  c :  20  } , myBool :  true , inputValue :  "默认内容" , myInt  : 1 , } ; } , methods :  { output ( )  { console. log ( "outputComputedmethod执行了" ) ; return  "标题为"  +  this . title +  ",内容为:"  +  this . content; } , btnT1 ( )  { this . title +=  1 ; } , btnT2 ( )  { this . myBool =  ! this . myBool; } , btnT3 ( )  { this . myInt+= 1 ; this . $refs. pRef. dataset. refData =  this . myInt; console. log ( "refData:" + this . $refs. pRef. dataset. refData) ; } , } , computed :  { outputComputed ( )  { console. log ( "method执行了" ) ; return  "标题为"  +  this . title +  ",内容为:"  +  this . content; } , } , watch :  { title ( newValue,  oldValue )  { console. log ( newValue) ; console. log ( "=========" ) ; console. log ( oldValue) ; } , } , 
} ; 
 </ script> < stylescoped > 
h3  { margin :  40px 0 0; 
} 
ul  { list-style-type :  none; padding :  0; 
} 
li  { display :  inline-block; margin :  0 10px; 
} 
a  { color :  #42b983; 
} 
 </ style>