修改switch、checkbox组件
This commit is contained in:
parent
757f72328d
commit
f76987a18e
|
@ -1,6 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<view class="agreement">
|
<view class="agreement">
|
||||||
<widget-check-box :checked="defaultState" @change="change" />
|
<widget-check-box :checked="agree" />
|
||||||
<view class="description">
|
<view class="description">
|
||||||
<text class="text">我已阅读并同意</text>
|
<text class="text">我已阅读并同意</text>
|
||||||
<text class="link">《熊熊安装服务协议》</text>
|
<text class="link">《熊熊安装服务协议》</text>
|
||||||
|
@ -17,7 +17,7 @@ export default {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
defaultState: {
|
agree: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false,
|
default: false,
|
||||||
},
|
},
|
||||||
|
@ -28,11 +28,7 @@ export default {
|
||||||
created() {},
|
created() {},
|
||||||
mounted() {},
|
mounted() {},
|
||||||
destroyed() {},
|
destroyed() {},
|
||||||
methods: {
|
methods: {},
|
||||||
change(state) {
|
|
||||||
this.$emit("agree", state);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<view
|
<view
|
||||||
class="checkbox"
|
class="checkbox"
|
||||||
:class="[state ? 'active' : '']"
|
:class="[checked ? 'active' : '']"
|
||||||
:style="{ fontSize: $utils.rpx2px(size) + 'px' }"
|
:style="{ fontSize: $utils.rpx2px(size) + 'px' }"
|
||||||
@click="changeCheckBox"
|
|
||||||
>
|
>
|
||||||
<text v-if="state" class="iconfont icon-xuanzeyixuanze"></text>
|
<text v-if="checked" class="iconfont icon-xuanzeyixuanze"></text>
|
||||||
<text v-if="!state" class="iconfont icon-xuanzeweixuanze"></text>
|
<text v-if="!checked" class="iconfont icon-xuanzeweixuanze"></text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -14,9 +13,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: "widget-checkbox",
|
name: "widget-checkbox",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {};
|
||||||
state: false,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
size: {
|
size: {
|
||||||
|
@ -29,17 +26,10 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
created() {
|
created() {},
|
||||||
this.state = this.checked;
|
|
||||||
},
|
|
||||||
mounted() {},
|
mounted() {},
|
||||||
destroyed() {},
|
destroyed() {},
|
||||||
methods: {
|
methods: {},
|
||||||
changeCheckBox() {
|
|
||||||
this.state = !this.state;
|
|
||||||
this.$emit("change", this.state);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<view
|
<view
|
||||||
class="switch"
|
class="switch"
|
||||||
:class="[state ? 'active' : '']"
|
:class="[open ? 'active' : '']"
|
||||||
:style="{ fontSize: $utils.rpx2px(size) + 'px' }"
|
:style="{ fontSize: $utils.rpx2px(size) + 'px' }"
|
||||||
@click="changeSwitch"
|
|
||||||
>
|
>
|
||||||
<text v-if="!state" class="iconfont icon-kaiguan-guan"></text>
|
<text v-if="!open" class="iconfont icon-kaiguan-guan"></text>
|
||||||
<text v-if="state" class="iconfont icon-kaiguan-kai"></text>
|
<text v-if="open" class="iconfont icon-kaiguan-kai"></text>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -14,9 +13,7 @@
|
||||||
export default {
|
export default {
|
||||||
name: "widget-switch",
|
name: "widget-switch",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {};
|
||||||
state: false,
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
size: {
|
size: {
|
||||||
|
@ -29,17 +26,10 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
created() {
|
created() {},
|
||||||
this.state = this.open;
|
|
||||||
},
|
|
||||||
mounted() {},
|
mounted() {},
|
||||||
destroyed() {},
|
destroyed() {},
|
||||||
methods: {
|
methods: {},
|
||||||
changeSwitch() {
|
|
||||||
this.state = !this.state;
|
|
||||||
this.$emit("change", this.state);
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,9 @@
|
||||||
</view>
|
</view>
|
||||||
<view class="switch-container">
|
<view class="switch-container">
|
||||||
<text class="price">¥ 6.00</text>
|
<text class="price">¥ 6.00</text>
|
||||||
<widget-switch @change="changeInsurance" />
|
<text @click="insurance = !insurance">
|
||||||
|
<widget-switch :open="insurance" />
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="demand">
|
<view class="demand">
|
||||||
|
@ -66,7 +68,9 @@
|
||||||
/>
|
/>
|
||||||
</view>
|
</view>
|
||||||
<view class="agreement-container">
|
<view class="agreement-container">
|
||||||
<agreement @agree="agree" />
|
<text @click="isAgree = !isAgree">
|
||||||
|
<agreement :agree="isAgree" />
|
||||||
|
</text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<view
|
<view
|
||||||
|
@ -94,8 +98,8 @@ export default {
|
||||||
addressId: 0,
|
addressId: 0,
|
||||||
addressText: "",
|
addressText: "",
|
||||||
datetime: "",
|
datetime: "",
|
||||||
insurance: false,
|
|
||||||
message: "",
|
message: "",
|
||||||
|
insurance: false,
|
||||||
isAgree: false,
|
isAgree: false,
|
||||||
serviceList: [
|
serviceList: [
|
||||||
{
|
{
|
||||||
|
@ -154,14 +158,6 @@ export default {
|
||||||
showCancel: false,
|
showCancel: false,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
changeInsurance(state) {
|
|
||||||
this.insurance = state;
|
|
||||||
console.log(this.insurance);
|
|
||||||
},
|
|
||||||
agree(state) {
|
|
||||||
this.isAgree = state;
|
|
||||||
console.log(this.isAgree);
|
|
||||||
},
|
|
||||||
pay() {
|
pay() {
|
||||||
if (!this.isAgree) {
|
if (!this.isAgree) {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
|
|
Loading…
Reference in New Issue