亚洲精品久久久中文字幕-亚洲精品久久片久久-亚洲精品久久青草-亚洲精品久久婷婷爱久久婷婷-亚洲精品久久午夜香蕉

您的位置:首頁(yè)技術(shù)文章
文章詳情頁(yè)

vue中template的三種寫(xiě)法示例

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

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

直接寫(xiě)在vue構(gòu)造器里,這種寫(xiě)法比較直觀,適用于html代碼不多的場(chǎng)景,但是如果模板里html代碼太多,不便于維護(hù),不建議這么寫(xiě).

<!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/[email protected]/dist/quasar.umd.min.js'></script> --> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/[email protected]'></script> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/[email protected]'></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>

第二種:

直接寫(xiě)在template標(biāo)簽里,這種寫(xiě)法跟寫(xiě)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/[email protected]/dist/quasar.umd.min.js'></script> --> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/[email protected]'></script> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/[email protected]'></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>

第三種:

寫(xiě)在script標(biāo)簽里,這種寫(xiě)法官方推薦,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/[email protected]/dist/quasar.umd.min.js'></script> --> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/[email protected]'></script> <script src='https://www.mobibrw.com/wp-content/uploads/2020/06/[email protected]'></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的三種寫(xiě)法示例的詳細(xì)內(nèi)容,更多關(guān)于vue template的資料請(qǐng)關(guān)注好吧啦網(wǎng)其它相關(guān)文章!

標(biāo)簽: Vue
相關(guān)文章:
主站蜘蛛池模板: 日韩欧美一区二区在线观看 | 蕾丝视频在线看片国产 | 三级网址在线 | 国语自产精品视频在线区 | 欧美人体一区二区三区 | 久久久久久综合对白国产 | 日韩三级小视频 | 麻豆精品密在线观看 | 久久国产精品最新一区 | 久草在线中文888 | 国内自拍视频网站 | 综合伊人久久在一二三区 | 91啦在线观看 | 国产欧美在线一区二区三区 | 你懂的网站在线观看网址 | 996免费视频国产在线播放 | 欧美啪啪一区 | 国产久热香蕉在线观看 | 欧美蜜臀| 亚洲人在线 | 色综合亚洲综合网站综合色 | 黄色电影毛片 | a毛片免费全部在线播放毛 a毛片免费全部播放毛 | 欧美日一区二区三区 | 欧美日韩一区二区三区毛片 | 免费a级毛片在线播放 | 国产一国产一级毛片视频 | 经典三级影院 | 岛国激情片 | 一级做a爰片性色毛片新版的 | 午夜亚洲精品久久久久 | 一级片黄 | 美国一级毛片免费看成人 | 国产成人做受免费视频 | 国产高清啪啪 | 欧美一级片毛片免费观看视频 | 日批在线视频 | 国产成人精品日本亚洲直接 | 日韩一级黄色影片 | 九九99re在线视频精品免费 | 伊人久久久综在合线久久在播 |