提交 8314e195 编写于 作者: S suzigang

fix(searchbar): textalign types

上级 bca3f559
......@@ -116,10 +116,10 @@
"transliteration": "^2.2.0",
"ts-jest": "^26.5.5",
"typescript": "4.6.4",
"vite": "^2.9.12",
"vite": "2.9.0",
"vite-plugin-dts": "^1.0.5",
"vite-plugin-md": "^0.11.8",
"vue": "3.2.24",
"vue": "^3.2.24",
"vue-jest": "^5.0.0-alpha.7"
},
"eslintConfig": {
......
......@@ -24,15 +24,10 @@
@focus="valueFocus"
@blur="valueBlur"
@confirm="handleSubmit"
:style="(styleSearchbar as CSSProperties)"
:style="styleSearchbar"
/>
</form>
<view
@click="handleClear"
class="nut-searchbar__input-clear"
v-if="clearable"
v-show="(modelValue as string).length > 0"
>
<view @click="handleClear" class="nut-searchbar__input-clear" v-if="clearable" v-show="modelValue.length > 0">
<nut-icon :name="clearIcon" size="12" color="#555"></nut-icon>
</view>
</view>
......@@ -50,10 +45,6 @@
import { toRefs, reactive, computed, ref, onMounted, PropType, Ref, CSSProperties } from 'vue';
import { createComponent } from '@/packages/utils/create';
const { create, translate } = createComponent('searchbar');
// interface Events {
// eventName: 'change' | 'focus' | 'blur' | 'clear' | 'update:modelValue';
// params: (string | number | Event)[];
// }
export type confirmTextType = 'send' | 'search' | 'next' | 'go' | 'done';
export default create({
......@@ -202,12 +193,12 @@ export default create({
};
const styleSearchbar = computed(() => {
return {
style: {
textAlign: props.inputAlign
}
const style: CSSProperties = {
textAlign: props.inputAlign as import('./type').TextAlign
};
return style;
});
const inputsearch: Ref<HTMLElement | null> = ref(null);
onMounted(() => {
if (props.autofocus) {
......
......@@ -56,7 +56,6 @@
<script lang="ts">
import { toRefs, reactive, computed, onMounted, ref, Ref, CSSProperties } from 'vue';
import { createComponent } from '@/packages/utils/create';
import { TextAlignProperty } from 'csstype';
const { create, translate } = createComponent('searchbar');
// interface Events {
// eventName: 'change' | 'focus' | 'blur' | 'clear' | 'update:modelValue';
......@@ -209,7 +208,7 @@ export default create({
const styleSearchbar = computed(() => {
const style: CSSProperties = {
textAlign: props.inputAlign as TextAlignProperty
textAlign: props.inputAlign as import('./type').TextAlign
};
return style;
});
......
export type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册