VUE框架,则是遵行了这个标准。

1、html文件

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>My First WebComponent</title>
<link rel="import" href="components/favorite-colour.html" />
</head>
<body>
<favorite-colour></favorite-colour>
</body>
</html>

2、模板文件

<!-- WebComponent example based off element-boilerplate: https://github.com/webcomponents/element-boilerplate -->
<template>
<style>
.coloured {
color: red;
}
</style>
<p>My favorite colour is: <strong class="coloured">Red</strong></p>
</template>
<script>
(function() {
// Creates an object based in the HTML Element prototype
var element = Object.create(HTMLElement.prototype);
// Gets content from <template>
var template = document.currentScript.ownerDocument.querySelector('template').content;
// Fires when an instance of the element is created
element.createdCallback = function() {
// Creates the shadow root
var shadowRoot = this.createShadowRoot();
// Adds a template clone into shadow root
var clone = document.importNode(template, true);
shadowRoot.appendChild(clone);
};
document.registerElement('favorite-colour1', {
prototype: element
});
}());
</script>

最新文章

  1. 2.WindowsServer2012R2装完的一些友好化设置
  2. js+css实现骰子的随机转动
  3. [POJ2151]Check the difficulty of problems (概率dp)
  4. android中的广播接收实现总结
  5. iOS - JSON 数据解析
  6. X Window 设定介绍
  7. 【转】GCC编译使用动态链接库
  8. OWA修改密码注意事项
  9. 装多版本号sqlserver的远程连接问题
  10. 如何让DbGrid支持鼠标滚轮滚动
  11. Python眼睛护士改进版
  12. Web API之消息处理管道
  13. HTTP状态码含义
  14. 笨方法学python--变量和命名
  15. Android学习之Animation(二)
  16. 和菜鸟一起学linux之initramfs方式启动
  17. IT人员必须掌握的10项软技能
  18. vue中嵌套页面 iframe 标签
  19. [ 9.24 ]CF每日一题系列—— 468A构造递推
  20. ES系列八、正排索Doc Values和Field Data

热门文章

  1. Makefile的引入及规则
  2. 【旧文章搬运】更正一个枚举PspCidTable时的错误
  3. RESTEasy使用json返回的例子
  4. Prepare for Mac App Store Submission--为提交到Mac 应用商店做准备
  5. PHP empty()函数使用需要注意
  6. k-means 算法介绍
  7. hdoj1001【智障了。。。】
  8. python __builtins__ tuple类 (68)
  9. 各大版本idea永久破解激活方法
  10. Selenium | 简单使用