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

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

vue中template的三種寫法示例

瀏覽:83日期: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
相關文章:
主站蜘蛛池模板: 国产一区二区三区日韩欧美 | 激情欧美成人狠狠色金八天国 | 国产一区二区三区丶四区 | 久久午夜国产片 | 丝袜美腿视频一区二区三区 | 国产成人黄网在线免 | 国产又黄又爽又色视频观看免费 | 免费看污污网站 | 成人一区专区在线观看 | 国产一区在线免费观看 | 亚洲欧美精品中字久久99 | 男人和女人全黄一级毛片 | 欧美激情艳三级 | 国产一级特黄一级毛片 | 国产在线观看91精品不卡 | 免费区欧美一级毛片精品 | 欧美性色福利视频在线观看 | 91影视在线 | 久久综合久美利坚合众国 | 国外成人免费高清激情视频 | www.中文字幕在线观看 | 国产精品网站在线观看 | 欧美曰b| 国产精品入口麻豆免费观看 | 国产欧美一区二区精品性色99 | 国产美腿丝袜福利视频在线观看 | 欧美视频在线播放观看免费福利资源 | 高清在线一区二区 | 亚洲国产精品一区二区久 | 久久综合中文字幕一区二区 | 亚洲天堂爱爱 | 综合色中色 | 在线国产一区 | 天天插综合网 | 黄色一级片免费看 | 日本一级片在线播放 | 欧美日韩在线精品成人综合网 | 色综合视频一区二区三区 | 精品一区二区三区水蜜桃 | 国产成人综合手机在线播放 | 精品国产免费观看一区 |