提交 1343fe66 编写于 作者: zcdtk's avatar zcdtk

单选框列表组件代码格式化

上级 ca71dc91
...@@ -10,28 +10,21 @@ ...@@ -10,28 +10,21 @@
</template> </template>
<script lang="ts"> <script lang="ts">
import { import { Vue, Component, Prop } from "vue-property-decorator";
Vue,
Component,
Prop,
Provide,
Emit,
Watch
} from "vue-property-decorator";
import CodeListService from "@app-core/service/app/code-list-service"; import CodeListService from "@app-core/service/app/code-list-service";
@Component({ @Component({
components: {} components: {}
}) })
export default class AppMobRadio extends Vue { export default class AppMobRadio extends Vue {
/** /**
* 代码表服务对象 * 代码表服务对象
* *
* @type {CodeListService} * @type {CodeListService}
* @memberof AppMobRadio * @memberof AppMobRadio
*/ */
public codeListService: CodeListService = CodeListService.getInstance();
public codeListService: CodeListService = new CodeListService();
/** /**
* 代码表标识 * 代码表标识
...@@ -39,7 +32,7 @@ export default class AppMobRadio extends Vue { ...@@ -39,7 +32,7 @@ export default class AppMobRadio extends Vue {
* @type {string} * @type {string}
* @memberof AppMobRadio * @memberof AppMobRadio
*/ */
@Prop() public tag?: string; @Prop() public tag!: string;
/** /**
* 代码表类型 * 代码表类型
...@@ -75,29 +68,53 @@ export default class AppMobRadio extends Vue { ...@@ -75,29 +68,53 @@ export default class AppMobRadio extends Vue {
/** /**
* change事件 * change事件
*
* @param {*} data
* @memberof AppMobRadio
*/ */
public change(data: any) { public change(data: any) {
this.$emit("change", data.detail.value); this.$emit("change", data.detail.value);
} }
/**
* vue 生命周期
*
* @returns
* @memberof AppMobRadio
*/
public created() { public created() {
if (this.tag && this.type) { if (!this.tag || !this.type) {
if (Object.is(this.type, "dynamic")) { return;
this.codeListService }
.getItems(this.tag) this.loadItems();
.then((res: any) => { }
this.options = res;
}) /**
.catch((error: any) => { * 加载 数据
*
* @private
* @returns {Promise<any>}
* @memberof AppMobRadio
*/
private async loadItems(): Promise<any> {
if (Object.is(this.type, 'dynamic')) {
const response: any = await this.codeListService.getItems(this.tag);
if (response && response.status === 200) {
this.options = response.data;
} else {
this.options = []; this.options = [];
}); }
} else { } else {
this.options = this.$store.getters.getCodeListItems(this.tag); this.options = this.$store.getters.getCodeListItems(this.tag);
} }
} }
}
public mounted(){ /**
* vue 生命周期
*
* @memberof AppMobRadio
*/
public mounted() {
this.changeLabelStyle(); this.changeLabelStyle();
} }
...@@ -108,7 +125,9 @@ export default class AppMobRadio extends Vue { ...@@ -108,7 +125,9 @@ export default class AppMobRadio extends Vue {
public changeLabelStyle() { public changeLabelStyle() {
document.querySelectorAll(".app-mobile-radio-list").forEach((element: any) => { document.querySelectorAll(".app-mobile-radio-list").forEach((element: any) => {
let prev = this.getNearEle(element, 1); let prev = this.getNearEle(element, 1);
if (prev) {
prev.style.transform = 'none'; prev.style.transform = 'none';
}
}) })
} }
...@@ -133,5 +152,6 @@ export default class AppMobRadio extends Vue { ...@@ -133,5 +152,6 @@ export default class AppMobRadio extends Vue {
} }
} }
</script> </script>
<style lang="less"> <style lang="less">
</style> </style>
\ No newline at end of file
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
}, },
"rules": { "rules": {
"quotemark": false, "quotemark": false,
"indent": [true, "spaces", 2], "indent": [true, "spaces", 4],
"interface-name": false, "interface-name": false,
"ordered-imports": false, "ordered-imports": false,
"object-literal-sort-keys": false, "object-literal-sort-keys": false,
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册