12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- <template>
- <view class="cl-page">
- <!-- toast -->
- <cl-toast ref="toast"></cl-toast>
- <!-- message-->
- <cl-message ref="message"></cl-message>
- <!-- loading-mask -->
- <cl-loading-mask
- ref="loader"
- :loading="loader.loading"
- :text="loader.text"
- ></cl-loading-mask>
- <!-- confirm -->
- <cl-confirm ref="confirm"></cl-confirm>
- <!-- content -->
- <slot></slot>
- </view>
- </template>
- <script>
- import { mapGetters } from "vuex";
- export default {
- componentName: "ClPage",
- props: {
- getUserInfo: Boolean,
- },
- data() {
- return {
- loader: {
- loading: false,
- text: "加载中",
- },
- };
- },
- computed: {
- ...mapGetters(["userInfo"]),
- },
- watch: {
- userInfo(val) {
- if (val) {
- this.$emit("userInfo", val);
- }
- },
- },
- mounted() {
- const { showLoading, hideLoading, showMessage, showToast, showConfirm } = this;
- this.$parent.$app = {
- showLoading,
- hideLoading,
- showMessage,
- showToast,
- showConfirm,
- };
- },
- methods: {
- showLoading(options = {}) {
- Object.assign(this.loader, options, {
- loading: true,
- });
- },
- hideLoading() {
- this.loader.loading = false;
- },
- showMessage(options) {
- this.$refs["message"].open(options);
- },
- showToast(options) {
- this.$refs["toast"].open(options);
- },
- showConfirm(options) {
- this.$refs["confirm"].open(options);
- },
- },
- };
- </script>
|