fix(eslint): fix eslint globals

This commit is contained in:
pengYYY 2022-02-16 20:22:02 +08:00
parent e3055c16b6
commit 04932ec0f5
12 changed files with 82 additions and 95 deletions

View File

@ -11,6 +11,10 @@
"jest": true, "jest": true,
"es6": true "es6": true
}, },
"globals": {
"defineProps": "readonly",
"defineEmits": "readonly"
},
"plugins": [ "plugins": [
"vue", "vue",
"@typescript-eslint" "@typescript-eslint"

View File

@ -23,9 +23,9 @@
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"qrcode.vue": "^3.2.2", "qrcode.vue": "^3.2.2",
"tdesign-icons-vue-next": "^0.0.6", "tdesign-icons-vue-next": "^0.0.6",
"tdesign-vue-next": "0.7.0-alpha.0", "tdesign-vue-next": "^0.8.0",
"tvision-color": "^1.3.1", "tvision-color": "^1.3.1",
"vue": "^3.1.5", "vue": "^3.2.31",
"vue-color-kit": "^1.0.5", "vue-color-kit": "^1.0.5",
"vue-router": "^4.0.11", "vue-router": "^4.0.11",
"vue3-clipboard": "^1.0.0", "vue3-clipboard": "^1.0.0",

View File

@ -9,21 +9,15 @@
<user-avatar-icon v-if="product.type === 4" /> <user-avatar-icon v-if="product.type === 4" />
<laptop-icon v-if="product.type === 5" /> <laptop-icon v-if="product.type === 5" />
</div> </div>
<t-tag :theme="product.isSetup ? 'success' : 'default'" :disabled="!product.isSetup">{{ <t-tag :theme="product.isSetup ? 'success' : 'default'" :disabled="!product.isSetup">
product.isSetup ? '已启用' : '已停用' {{ product.isSetup ? '已启用' : '已停用' }}
}}</t-tag> </t-tag>
</t-row> </t-row>
<p class="list-card-item_detail--name"> <p class="list-card-item_detail--name">{{ product.name }}</p>
{{ product.name }} <p class="list-card-item_detail--desc">{{ product.description }}</p>
</p>
<p class="list-card-item_detail--desc">
{{ product.description }}
</p>
<t-row justify="space-between" align="middle" :class="cardControlClass"> <t-row justify="space-between" align="middle" :class="cardControlClass">
<div> <div>
<t-button shape="circle" :disabled="!product.isSetup"> <t-button shape="circle" :disabled="!product.isSetup">{{ typeMap[product.type - 1] }}</t-button>
{{ typeMap[product.type - 1] }}
</t-button>
<t-button shape="circle" :disabled="!product.isSetup"> <t-button shape="circle" :disabled="!product.isSetup">
<add-icon /> <add-icon />
</t-button> </t-button>
@ -53,7 +47,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, defineProps, PropType, defineEmits } from 'vue'; import { computed, PropType } from 'vue';
import { import {
ShopIcon, ShopIcon,
CalendarIcon, CalendarIcon,

View File

@ -17,7 +17,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, computed } from 'vue'; import { computed } from 'vue';
const props = defineProps({ const props = defineProps({
title: String, title: String,

View File

@ -2,7 +2,7 @@
<div :style="style" class="color-container" /> <div :style="style" class="color-container" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, computed } from 'vue'; import { computed } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { getBrandColor } from '@/config/color'; import { getBrandColor } from '@/config/color';

View File

@ -9,7 +9,7 @@
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, computed } from 'vue'; import { computed } from 'vue';
import Result403Icon from '@/assets/assets-result-403.svg?component'; import Result403Icon from '@/assets/assets-result-403.svg?component';
import Result404Icon from '@/assets/assets-result-404.svg?component'; import Result404Icon from '@/assets/assets-result-404.svg?component';
import Result500Icon from '@/assets/assets-result-500.svg?component'; import Result500Icon from '@/assets/assets-result-500.svg?component';

View File

@ -2,7 +2,7 @@
<img :class="className" :src="url" /> <img :class="className" :src="url" />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { computed, defineProps } from 'vue'; import { computed } from 'vue';
const props = defineProps({ const props = defineProps({
url: String, url: String,

View File

@ -21,7 +21,7 @@
</span> </span>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, computed } from 'vue'; import { computed } from 'vue';
const props = defineProps({ const props = defineProps({
type: String, type: String,

View File

@ -64,7 +64,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineProps, PropType, computed } from 'vue'; import { PropType, computed } from 'vue';
import { useStore } from 'vuex'; import { useStore } from 'vuex';
import { useRouter, useRoute } from 'vue-router'; import { useRouter, useRoute } from 'vue-router';

View File

@ -37,7 +37,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, defineProps } from 'vue'; import { ref } from 'vue';
const layout = defineProps({ const layout = defineProps({
type: String, type: String,

View File

@ -8,8 +8,8 @@
</t-form-item> </t-form-item>
<t-form-item label="产品状态" name="status"> <t-form-item label="产品状态" name="status">
<t-radio-group v-model="formData.status"> <t-radio-group v-model="formData.status">
<t-radio value="0"> 已停用 </t-radio> <t-radio value="0">已停用</t-radio>
<t-radio value="1"> 已启用 </t-radio> <t-radio value="1">已启用</t-radio>
</t-radio-group> </t-radio-group>
</t-form-item> </t-form-item>
<t-form-item label="产品描述" name="description"> <t-form-item label="产品描述" name="description">
@ -26,16 +26,16 @@
<t-textarea v-model="textareaValue" :style="{ width: '480px' }" placeholder="请输入内容" name="description" /> <t-textarea v-model="textareaValue" :style="{ width: '480px' }" placeholder="请输入内容" name="description" />
</t-form-item> </t-form-item>
<t-form-item style="float: right"> <t-form-item style="float: right">
<t-button variant="outline" @click="onClickCloseBtn"> 取消 </t-button> <t-button variant="outline" @click="onClickCloseBtn">取消</t-button>
<t-button theme="primary" type="submit"> 确定 </t-button> <t-button theme="primary" type="submit">确定</t-button>
</t-form-item> </t-form-item>
</t-form> </t-form>
</template> </template>
</t-dialog> </t-dialog>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import { defineComponent, ref, watch } from 'vue'; import { ref, watch } from 'vue';
import { MessagePlugin } from 'tdesign-vue-next'; import { MessagePlugin } from 'tdesign-vue-next';
const INITIAL_DATA = { const INITIAL_DATA = {
@ -53,8 +53,7 @@ const SELECT_OPTIONS = [
{ label: 'CVM', value: '3' }, { label: 'CVM', value: '3' },
]; ];
export default defineComponent({ const props = defineProps({
props: {
visible: { visible: {
type: Boolean, type: Boolean,
default: false, default: false,
@ -65,13 +64,13 @@ export default defineComponent({
return {}; return {};
}, },
}, },
}, });
setup(props, ctx) {
const formVisible = ref(false);
const formData = ref(props.data);
const textareaValue = ref('');
const onSubmit = ({ result, firstError }) => { const formVisible = ref(false);
const formData = ref(props.data);
const textareaValue = ref('');
const onSubmit = ({ result, firstError }) => {
if (!firstError) { if (!firstError) {
MessagePlugin.success('提交成功'); MessagePlugin.success('提交成功');
formVisible.value = false; formVisible.value = false;
@ -79,46 +78,36 @@ export default defineComponent({
console.log('Errors: ', result); console.log('Errors: ', result);
MessagePlugin.warning(firstError); MessagePlugin.warning(firstError);
} }
}; };
const onClickCloseBtn = () => { const onClickCloseBtn = () => {
formVisible.value = false; formVisible.value = false;
formData.value = { ...INITIAL_DATA }; formData.value = { ...INITIAL_DATA };
}; };
watch( const emit = defineEmits(['update:visible']);
watch(
() => formVisible.value, () => formVisible.value,
(val) => { (val) => {
const { emit } = ctx;
emit('update:visible', val); emit('update:visible', val);
}, },
); );
watch( watch(
() => props.visible, () => props.visible,
(val) => { (val) => {
formVisible.value = val; formVisible.value = val;
}, },
); );
watch( watch(
() => props.data, () => props.data,
(val) => { (val) => {
formData.value = val; formData.value = val;
}, },
); );
return { const rules = {
SELECT_OPTIONS,
formVisible,
formData,
textareaValue,
onSubmit,
onClickCloseBtn,
rules: {
name: [{ required: true, message: '请输入产品名称', type: 'error' }], name: [{ required: true, message: '请输入产品名称', type: 'error' }],
}, };
};
},
});
</script> </script>

View File

@ -71,7 +71,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { defineEmits, ref } from 'vue'; import { ref } from 'vue';
import { MessagePlugin } from 'tdesign-vue-next'; import { MessagePlugin } from 'tdesign-vue-next';
import { useCounter } from '@/hooks'; import { useCounter } from '@/hooks';