Skip to content

Commit

Permalink
Merge pull request #9 from Hubmeat/feat/taro-share-chat
Browse files Browse the repository at this point in the history
fix: comp with share-type property
  • Loading branch information
AdvancedCat authored Aug 16, 2022
2 parents da852b2 + 74e4e9e commit 3c0da36
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
dist/
dist-dev/
types
node_modules
.DS_Store
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
},
"scripts": {
"build": "rollup -c",
"dev": "rollup -c -w"
"dev": "NODE_ENV=development rollup -c -w"
},
"bugs": {
"url": "https://github.com/NervJS/taro-plugin-platform-xhs/issues"
Expand Down
8 changes: 5 additions & 3 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import json from '@rollup/plugin-json'

const cwd = __dirname

const output = process.env.NODE_ENV === 'development' ? 'dist-dev' : 'dist';

const base = {
external: ['@tarojs/shared', '@tarojs/service'],
plugins: [typescript({
Expand All @@ -16,7 +18,7 @@ const base = {
const compileConfig = {
input: join(cwd, 'src/index.ts'),
output: {
file: join(cwd, 'dist/index.js'),
file: join(cwd, `${output}/index.js`),
format: 'cjs',
sourcemap: true,
exports: 'named'
Expand All @@ -28,7 +30,7 @@ const compileConfig = {
const runtimeConfig = {
input: join(cwd, 'src/runtime.ts'),
output: {
file: join(cwd, 'dist/runtime.js'),
file: join(cwd, `${output}/runtime.js`),
format: 'es',
sourcemap: true
},
Expand All @@ -39,7 +41,7 @@ const runtimeConfig = {
const runtimeUtilsConfig = {
input: join(cwd, 'src/runtime-utils.ts'),
output: {
file: join(cwd, 'dist/runtime-utils.js'),
file: join(cwd, `${output}/runtime-utils.js`),
format: 'es',
sourcemap: true
},
Expand Down
3 changes: 2 additions & 1 deletion src/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export const components = {
size: '23'
},
Button: {
'data-channel': '',
'data-channel': singleQuote(''),
'share-type': singleQuote('normal'),
bindGetPhoneNumber: '',
bindGetUserInfo: '',
bindOpenSetting: '',
Expand Down
7 changes: 7 additions & 0 deletions src/template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ export class Template extends RecursiveTemplate {

replacePropName (name: string, value: string, componentName:string) {
if (value === 'eh') return name.toLowerCase()

/**
* button 组件, 修改 share-type 字段为 data-share-type
*/
if (componentName === 'button') {
if (name === 'share-type') return 'data-share-type'
}
return name
}
}

0 comments on commit 3c0da36

Please sign in to comment.