将html结构写在一对script标签中,设置type=“x-template”

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<script src="./vue.js"></script>
</head>
<body>
<div id="demo">
<span>miaov ketang</span>
</div>
<script type="x-template" id="temp">
<div>
hello {{abc}}
<span>miaov</span>
</div>
</script>
<script>
let obj={
html:"<div>hello,miaov</div>",
abc:
};
var vm=new Vue({
el:"#demo",
data:obj,
template:"#temp" /*将新渲染的str替换掉前面的整个div*/
//
})
</script>
</body>
</html>

.

Vue之x-template(2)的更多相关文章

  1. vue error:The template root requires exactly one element.

    error:[vue/valid-template-root] The template root requires exactly one element. 原因: 因为vue的模版中只有能一个根节 ...

  2. [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

    转载自:https://segmentfault.com/a/1190000006435886 解决办法:添加package.config.js配置文件中,添加本文章的红色部分代码 import vu ...

  3. Vue学习笔记 template methods,filters,ChromeDriver,安装sass

    ChromeDriver installation failed Error with http(s) request: Error: connect ETIMEDOUT 172.217.160.80 ...

  4. Kendo-Grid for Vue API and Template

    写此博客的原因:在做项目时前端用的vue,后端用的jfinal.在前端veu中调用了kendo grid插件,但是在官方文档中对kendo grid for vue 的api和template都不太详 ...

  5. [Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available

    原文链接https://blog.csdn.net/xiaomajia029/article/details/88320233 问题描述: 原因分析:在项目配置的时候,默认 npm 包导出的是运行时构 ...

  6. You are using the runtime-only build of Vue where the template compiler is not available. Either pre

    在升级脚手架到vue-cli3.0版本的时候出现了这个报错: [Vue warn]: You are using the runtime-only build of Vue where the tem ...

  7. You are using the runtime-only build of Vue where the template compiler is not available.

    使用vue-cli搭建的项目,启动报错 You are using the runtime-only build of Vue where the template compiler is not a ...

  8. You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.

    异常 You are using the runtime-only build of Vue where the template compiler is not available. Either ...

  9. 聊聊Vue.js的template编译

    写在前面 因为对Vue.js很感兴趣,而且平时工作的技术栈也是Vue.js,这几个月花了些时间研究学习了一下Vue.js源码,并做了总结与输出. 文章的原地址:https://github.com/a ...

  10. Vue中的template标签的使用和在template标签上使用v-for

    我们知道  .vue 文件的基本结构是: <template> ........ </template> <script> export default { nam ...

随机推荐

  1. 服务器mysql授权连接用户

    以下是创建到写入到删除,到drop的全部的过程: //1:创建数据库 create database it1110; //2:进入这个数据库 Use it1110; //3:创建一个数据表 Creat ...

  2. [Codeforces 545E] Paths and Trees

    [题目链接] https://codeforces.com/contest/545/problem/E [算法] 首先求 u 到所有结点的最短路 记录每个节点最短路径上的最后一条边         答 ...

  3. 【BZOJ 1233】 干草堆

    [题目链接] 点击打开链接 [算法] 这题有一个性质 : 位于顶层的干草堆可以满足宽度最小且高度最高 根据这个性质,用单调队列优化DP,即可 [代码] #include<bits/stdc++. ...

  4. bzoj2502【有上下界的最大流】

    2502: 清理雪道 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 834  Solved: 442[Submit][Status][Discuss] ...

  5. OC:数组排序、时间格式化字符串

    数组排序 //不可变数组的排序 NSArray * arr = [NSArray arrayWithObjects:@"hellow", @"lanou", @ ...

  6. Swift4 类与继承, 类型转换, 类型判断

    创建: 2018/03/05 完成: 2018/03/07 更新: 2018/03/09 完善标题 [Swift4 类与继承, 类型转换] -> [Swift4 类与继承, 类型转换与判断] 补 ...

  7. linux 安装和远程连接

    准备工作: 1.请安装好vmware 软件 2.linux 镜像包 3.putty 远程连接工具 任务: 设置好root 账号和普通账号 及设置网络 连接最简单使用桥接 只能ping 通 本机 nat ...

  8. 支持宕机自动恢复触发一次性或周期性任务执行的组件包首次介绍-easyTask

    easyTask介绍 一个方便触发一次性或周期性任务执行的工具包,支持海量,高并发,高可用,宕机自动恢复任务 使用场景 需要精确到秒的某一时刻触发任务执行.比如订单交易完成24小时后如果客户未评价,则 ...

  9. 数字货币期货与现货JavaScript量化策略代码详解汇总

    1.动态平衡策略 按照当前的 BTC 的价值,账户余额保留¥5000 现金和 0.1个 BTC,即现金和BTC 市值的初始比例是 1:1. 如果 BTC 的价格上涨至¥6000,即 BTC 市值大于账 ...

  10. Luogu P3916 图的遍历 【优雅的dfs】【内有待填坑】By cellur925

    说明 • 对于60% 的数据, n,m在1e3内 • 对于100% 的数据, n,m在1e5内. 本弱弱上来就是一顿暴搜打,dfs n次,每次更新答案,复杂度为O(n*n),果然TLE,60分抱回家. ...