色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

vue中template的三種寫法示例

瀏覽:84日期:2022-11-15 17:34:16

第一種(字符串模板寫法):

直接寫在vue構造器里,這種寫法比較直觀,適用于html代碼不多的場景,但是如果模板里html代碼太多,不便于維護,不建議這么寫.

<!DOCTYPE html><html> <!-- WARNING! Make sure that you match all Quasar related tags to the same version! (Below it’s '@1.7.4') --> <head> <!-- <link rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='stylesheet' type='text/css'> --> <link rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='stylesheet' type='text/css'> </head> <body> <div id='q-app'> </div> <!-- Add the following at the end of your body tag --> <!-- <script src='https://cdn.jsdelivr.net/npm/vue@^2.0.0/dist/vue.min.js'></script> <script src='https://cdn.jsdelivr.net/npm/quasar@1.7.4/dist/quasar.umd.min.js'></script> --> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/vue@2.0.0.js'></script> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/quasar.umd@1.7.4.js'></script> <script> /* Example kicking off the UI. Obviously, adapt this to your specific needs. Assumes you have a <div id='q-app'></div> in your <body> above */ new Vue({ el: ’#q-app’, data: function () { return { version: Quasar.version } }, template: `<div class='q-ma-md'> Running Quasar v{{ version }}</div>` // ...etc }) </script> </body></html>

第二種:

直接寫在template標簽里,這種寫法跟寫html很像。

<!DOCTYPE html><html> <!-- WARNING! Make sure that you match all Quasar related tags to the same version! (Below it’s '@1.7.4') --> <head> <!-- <link rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='stylesheet' type='text/css'> --> <link rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='stylesheet' type='text/css'> </head> <body> <div id='q-app'> <template id=’template1’> <div class='q-ma-md'> Running Quasar v{{ version }} </div> </template> </div> <!-- Add the following at the end of your body tag --> <!-- <script src='https://cdn.jsdelivr.net/npm/vue@^2.0.0/dist/vue.min.js'></script> <script src='https://cdn.jsdelivr.net/npm/quasar@1.7.4/dist/quasar.umd.min.js'></script> --> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/vue@2.0.0.js'></script> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/quasar.umd@1.7.4.js'></script> <script> /* Example kicking off the UI. Obviously, adapt this to your specific needs. Assumes you have a <div id='q-app'></div> in your <body> above */ new Vue({ el: ’#q-app’, data: function () { return { version: Quasar.version } }, template: ’#template1’ // ...etc }) </script> </body></html>

第三種:

寫在script標簽里,這種寫法官方推薦,vue官方推薦script中type屬性加上'x-template',即:

<!DOCTYPE html><html> <!-- WARNING! Make sure that you match all Quasar related tags to the same version! (Below it’s '@1.7.4') --> <head> <!-- <link rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='stylesheet' type='text/css'> --> <link rel='external nofollow' rel='external nofollow' rel='external nofollow' rel='stylesheet' type='text/css'> </head> <body> <div id='q-app'></div><script type='x-template' id='template1'> <div class='q-ma-md'> Running Quasar v{{ version }} </div> </script> <!-- Add the following at the end of your body tag --> <!-- <script src='https://cdn.jsdelivr.net/npm/vue@^2.0.0/dist/vue.min.js'></script> <script src='https://cdn.jsdelivr.net/npm/quasar@1.7.4/dist/quasar.umd.min.js'></script> --> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/vue@2.0.0.js'></script> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/quasar.umd@1.7.4.js'></script> <script> /* Example kicking off the UI. Obviously, adapt this to your specific needs. Assumes you have a <div id='q-app'></div> in your <body> above */ new Vue({ el: ’#q-app’, data: function () { return { version: Quasar.version } }, template: ’#template1’ // ...etc }) </script> </body></html>

以上就是vue中template的三種寫法示例的詳細內容,更多關于vue template的資料請關注好吧啦網其它相關文章!

標簽: Vue
相關文章:
主站蜘蛛池模板: 亚洲成人一区二区 | 日本 欧美 在线 | 91精品全国免费观看 | 91精品宅男在线观看 | 久久久久久久久久久观看 | 深夜福利亚洲 | 在线播放亚洲美女视频网站 | 成人羞羞视频国产 | 欧美视频一二三区 | 99爱视频免费高清在线观看 | 91精选视频在线观看 | 亚洲精品国产第一区二区三区 | 欧美一区二区在线播放 | 国产精品久久久久无毒 | 精品亚洲永久免费精品 | 亚洲一区免费视频 | 国产成人av在线 | 国产孕妇孕交视频在线观看 | 日本在线视频观看 | 欧美另类亚洲一区二区 | 性午夜 | 女人扒开双腿让男人捅 | 另类视频综合 | 久久久一区二区三区 | 亚洲第一狼人区 | 8000av在线| 亚洲成人777| 国产在线精品一区二区中文 | 日本美女作爱 | 成人黄网18免费观看的网站 | 黄色一级毛片 | 欧美一级毛片欧美大尺度一级毛片 | 日本一区二区三区免费视频 | 亚洲a免费 | 91欧美视频 | 欧美久草视频 | 成人区精品一区二区毛片不卡 | 日韩欧美中文字幕一区二区三区 | 在线视频一区二区三区在线播放 | 99精品在线免费 | 中国一级片免费看 |