vue中设定html颜色格式报错:[Vue warn]: Failed to resolve directive: html:
<div id="app-2"> <p> using: {{ message }} </p> <!-- <p>this whould be red: <span v-html: style="color: red">{{ rawHtml }}</span> </p>-->//这个是报错原因,已注释 <p>this will be blue: <span v-html="message" style="color: blue"></span> </p> <p>this will be red: <span v-html="message" style="color: red"></span> </p> </div> <script> 'use strict' let app2 = new Vue({ el: '#app-2', data: { message: 'html style' } }) </script>
显示结果:
using: html style
this will be blue: html style
this will be red: html style
 
                    
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号