提交初始版本,使用vant ui库
This commit is contained in:
1
miniprogram_npm/@vant/weapp/config-provider/index.d.ts
vendored
Normal file
1
miniprogram_npm/@vant/weapp/config-provider/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export {};
|
11
miniprogram_npm/@vant/weapp/config-provider/index.js
Normal file
11
miniprogram_npm/@vant/weapp/config-provider/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var component_1 = require("../common/component");
|
||||
(0, component_1.VantComponent)({
|
||||
props: {
|
||||
themeVars: {
|
||||
type: Object,
|
||||
value: {},
|
||||
},
|
||||
},
|
||||
});
|
3
miniprogram_npm/@vant/weapp/config-provider/index.json
Normal file
3
miniprogram_npm/@vant/weapp/config-provider/index.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"component": true
|
||||
}
|
5
miniprogram_npm/@vant/weapp/config-provider/index.wxml
Normal file
5
miniprogram_npm/@vant/weapp/config-provider/index.wxml
Normal file
@@ -0,0 +1,5 @@
|
||||
<wxs src="./index.wxs" module="computed" />
|
||||
|
||||
<view class="van-config-provider" style="{{ computed.mapThemeVarsToCSSVars(themeVars) }}">
|
||||
<slot />
|
||||
</view>
|
29
miniprogram_npm/@vant/weapp/config-provider/index.wxs
Normal file
29
miniprogram_npm/@vant/weapp/config-provider/index.wxs
Normal file
@@ -0,0 +1,29 @@
|
||||
/* eslint-disable */
|
||||
var object = require('../wxs/object.wxs');
|
||||
var style = require('../wxs/style.wxs');
|
||||
|
||||
function kebabCase(word) {
|
||||
var newWord = word
|
||||
.replace(getRegExp("[A-Z]", 'g'), function (i) {
|
||||
return '-' + i;
|
||||
})
|
||||
.toLowerCase()
|
||||
.replace(getRegExp("^-"), '');
|
||||
|
||||
return newWord;
|
||||
}
|
||||
|
||||
function mapThemeVarsToCSSVars(themeVars) {
|
||||
var cssVars = {};
|
||||
object.keys(themeVars).forEach(function (key) {
|
||||
var cssVarsKey = '--' + kebabCase(key);
|
||||
cssVars[cssVarsKey] = themeVars[key];
|
||||
});
|
||||
|
||||
return style(cssVars);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
kebabCase: kebabCase,
|
||||
mapThemeVarsToCSSVars: mapThemeVarsToCSSVars,
|
||||
};
|
Reference in New Issue
Block a user