|
楼主 |
发表于 2018-9-16 00:47:55
|
显示全部楼层
- <div id=main_20180907230001></div>
- <!--这后面的数值为当前的年月日时分秒,秒数随意-->
- <script>
- (function () {
- var root = document.getElementById("main_20180907230001")
- //生成系统
- var TagGroup = function (comVar, tags, htmlTag, className, className2, htmlTag2="a") {
- this.comVar = comVar
- this.tags = tags
- this.htmlTag = htmlTag
- this.htmlTag2 = htmlTag2
- this.className = className
- this.className2 = className2
- }
- TagGroup.prototype.create = function(){
- var _this = this
- return {
- view: function () {
- return _this.tags.map(function (value, index) {
- return m(_this.htmlTag, {
- class: _this.comVar == index ? _this.className + ' ' + _this.className2 : _this.className,
- onclick:
- function () {
- _this.comVar = index
- },
- },
- m(_this.htmlTag2,value))
- })
- }
- }
- }
- TagGroup.prototype.page = function(contents,tagName=""){
- var _this = this
- return {
- view:function(){
- return _this.tags.map(function(value,index){
- return m(tagName,{style:_this.comVar == index ? "" : "display:none"},contents[index])
- })
- }
- }
- }
- var 列表 = new TagGroup("",["欢迎词与寄语","社区地图","最新活动"],"li","li","gn-is-active","a[style=text-decoration:none]")
- var 列表内容 = [
- m("",m.trust(`这里是欢迎词与寄语`)),
- m("",m.trust(`这里是社区地图`)),
- m("",m.trust(`这里是最新活动`)),
- ]
- var home = function () {
- return {
- view: function () {
- return m("", [
- m("section.gn-hero.gn-is-primary", [
- m(".gn-hero-body", [
- m(".gn-has-text-centered", [
- m("h1[style=font-size:28px].gn-title", "欢迎加入技术宅社区♪(・ω・)ノ"),
- m("h2.gn-subtitle", "迎新大队:@Blue_Sdo")
- ])
- ]),
- m(".gn-hero-footer", [
- m("nav.gn-tabs.gn-is-boxed.gn-is-fullwidth", [
- m("", m("ul[style=margin:0;padding:0]", [
- /* m("li.gn-is-active", m("a[style=text-decoration:none]", "欢迎词与寄语")),
- m("li", m("a[style=text-decoration:none]", "最新活动")),
- m("li", m("a[style=text-decoration:none]", "社区地图")),
- m("li", m("a[style=text-decoration:none]", "社区介绍")), */
- m(列表.create())
- ]))
- ])
- ])
- ]),
- m("gn-section",[
- m(列表.page(列表内容))
- ])
- ])
- }
- }
- }
- m.mount(root, home)
- })()
- </script>
复制代码 |
|