字符串模板:
指的是在组件选项里用 template:"" 指定的模板,换句话说,写在 js 中的 template:"" 中的就是字符串模板。
比如下面这个:
var tmp = new Vue({
template:"<myComponent></myComponent>"
});
非字符串模板:
在单文件里用 <template></template> 指定的模板,换句话说,写在 html 中的就是非字符串模板。
本文深入探讨了Vue.js框架中的两种模板类型:字符串模板和非字符串模板。字符串模板是在组件选项里用template属性指定的,通常在JS代码中定义。而非字符串模板则是在单文件组件的<template>标签内指定,直接在HTML文件中书写。
指的是在组件选项里用 template:"" 指定的模板,换句话说,写在 js 中的 template:"" 中的就是字符串模板。
比如下面这个:
var tmp = new Vue({
template:"<myComponent></myComponent>"
});
在单文件里用 <template></template> 指定的模板,换句话说,写在 html 中的就是非字符串模板。
6369
824
459

被折叠的 条评论
为什么被折叠?