Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
MiniprogramTemplate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢卓城
MiniprogramTemplate
Commits
12296d21
Commit
12296d21
authored
Jan 25, 2021
by
谢卓城
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增:自动往app.json写入page
parent
3d6f8597
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
1 deletion
+60
-1
gulpfile.js
gulpfile.js
+19
-0
home-header.js
src/components/home-header/home-header.js
+24
-0
home-header.json
src/components/home-header/home-header.json
+4
-0
home-header.scss
src/components/home-header/home-header.scss
+6
-0
home-header.wxml
src/components/home-header/home-header.wxml
+4
-0
index.json
src/pages/index/index.json
+3
-1
No files found.
gulpfile.js
View file @
12296d21
...
@@ -11,6 +11,7 @@ const tap = require("gulp-tap");
...
@@ -11,6 +11,7 @@ const tap = require("gulp-tap");
const
path
=
require
(
"path"
);
const
path
=
require
(
"path"
);
const
notify
=
require
(
"gulp-notify"
);
const
notify
=
require
(
"gulp-notify"
);
const
yargs
=
require
(
"yargs"
);
const
yargs
=
require
(
"yargs"
);
const
fs
=
require
(
'fs'
);
const
srcPath
=
"./src/**"
;
const
srcPath
=
"./src/**"
;
const
distPath
=
"./dist/"
;
const
distPath
=
"./dist/"
;
...
@@ -206,6 +207,24 @@ const newfile = done => {
...
@@ -206,6 +207,24 @@ const newfile = done => {
stream
=
stream
.
pipe
(
rename
({
basename
:
name
.
toLowerCase
()
}));
stream
=
stream
.
pipe
(
rename
({
basename
:
name
.
toLowerCase
()
}));
}
}
if
(
type
==
"pages"
)
{
let
jsonPath
=
'./src/app.json'
;
fs
.
readFile
(
jsonPath
,
'utf8'
,
function
(
err
,
data
)
{
if
(
err
)
console
.
log
(
err
);
var
json
=
JSON
.
parse
(
data
);
//读取的值
json
.
pages
.
push
(
`
${
type
}
/
${
name
}
/
${
name
}
`
);
console
.
log
(
`
${
json
.
pages
}
`
);
//把数据读出来,然后进行修改
var
str
=
JSON
.
stringify
(
json
,
null
,
2
);
//console.log(str);
fs
.
writeFile
(
jsonPath
,
str
,
function
(
err
){
if
(
err
){
console
.
error
(
err
);
}
});
});
}
return
stream
.
pipe
(
gulp
.
dest
(
`src/
${
type
}
/
${
name
}
/`
));
return
stream
.
pipe
(
gulp
.
dest
(
`src/
${
type
}
/
${
name
}
/`
));
};
};
gulp
.
task
(
"new"
,
newfile
);
gulp
.
task
(
"new"
,
newfile
);
...
...
src/components/home-header/home-header.js
0 → 100644
View file @
12296d21
/**
* 除继承样式外, app.wxss 中的样式、组件所在页面的的样式对自定义组件无效。
* 参考文档:https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/wxml-wxss.html
* 采用 externalClasses 的方式 在组件.wxml需要的view的class加super-class,可以是多个
* 使用 <Component super-class="<#type#>" />
*/
Component
({
properties
:
{
is
:
Boolean
,
list
:
Array
,
title
:
String
// 简化的定义方式
},
externalClasses
:
[
"super-class"
],
data
:
{
content
:
"content"
},
methods
:
{
// 这里是一个自定义方法
tagAction
(
e
)
{
var
eventOption
=
{
content
:
e
.
currentTarget
.
dataset
.
text
};
// 触发事件的选项
this
.
triggerEvent
(
"tagClick"
,
eventOption
);
}
}
});
src/components/home-header/home-header.json
0 → 100644
View file @
12296d21
{
"component"
:
true
,
"usingComponents"
:
{}
}
\ No newline at end of file
src/components/home-header/home-header.scss
0 → 100644
View file @
12296d21
.container
{
width
:
100vw
;
.text
{
color
:
red
;
}
}
\ No newline at end of file
src/components/home-header/home-header.wxml
0 → 100644
View file @
12296d21
<!--template/components/index.wxml-->
<view class="container" hover-class="none" hover-stop-propagation="false">
<text class="flex-item super-class" selectable="false" space="false" decode="false" bindtap="tagAction" data-text="{{content}}">{{content}}</text>
</view>
src/pages/index/index.json
View file @
12296d21
{
{
"navigationBarTitleText"
:
"首页"
,
"navigationStyle"
:
"custom"
,
"usingComponents"
:
{}
"usingComponents"
:
{}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment