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

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

vue中template的三種寫法示例

瀏覽:75日期: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/[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>

第二種:

直接寫在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/[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>

第三種:

寫在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/[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的三種寫法示例的詳細內容,更多關于vue template的資料請關注好吧啦網其它相關文章!

標簽: Vue
相關文章:
主站蜘蛛池模板: 久久免费精品国产72精品剧情 | 男女午夜性爽快免费视频不卡 | 欧美精品三区 | 一本一道波多野结衣456 | 久久视频一区 | 成人欧美在线 | 精品欧美小视频在线观看 | 夜色综合| 久久精品国产欧美 | aaa在线| 欧美成人高清性色生活 | 欧美 日韩 国产 成人 在线观看 | 永久在线 | 久久久久久久久久久视频国内精品视频 | 欧美性精品hd在线观看 | 亚洲精品一区 | 精品乱人伦一区二区 | 99热在线获取最新地址 | 久草网首页| 综合 91在线精品 | 免费一级欧美大片视频在线 | 国产高清精品毛片基地 | 久久精品免观看国产成人 | 欧美午夜成年片在线观看 | 亚洲高清在线视频 | 免费人成观看在线网 | 国产精品久久久久久久久久久久 | 中文字幕在线成人免费看 | 日韩精品三级 | 日本一级特黄特色大片免费视频 | 久久99精品综合国产首页 | 亚洲成av人影片在线观看 | 亚洲品质自拍视频 | 欧美一级高清片 | 韩国在线精品福利视频在线观看 | 国产精品极品美女自在线看免费一区二区 | 亚州国产 | 免费看男女做好爽好硬视频 | 泷泽萝拉亚洲精品中文字幕 | 国产福利最新手机在线观看 | 欧美一区综合 |